Skip to content

Commit 24087b8

Browse files
[MIG] helpdesk_mgmt_assign_method: Migration to 19.0
Module last present on 17.0 (skipped on 18.0). Adaptations for Odoo 19: - @api.model_create_multi on helpdesk.ticket.create - _read_group instead of read_group for balanced assignment - tracking_disable in tests
1 parent ebfd991 commit 24087b8

17 files changed

Lines changed: 1145 additions & 0 deletions
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
===========================
6+
Helpdesk Mgmt Assign Method
7+
===========================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:801b3c6c99d8b6c04f1f4be1541e97c256d0c96b0574a5c25673af9d72f0f15d
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22+
:alt: License: AGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhelpdesk-lightgray.png?logo=github
24+
:target: https://github.com/OCA/helpdesk/tree/19.0/helpdesk_mgmt_assign_method
25+
:alt: OCA/helpdesk
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/helpdesk-19-0/helpdesk-19-0-helpdesk_mgmt_assign_method
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/helpdesk&target_branch=19.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
This module adds advanced ticket assignment methods to Odoo Helpdesk
36+
teams. You can configure each team to assign tickets manually, randomly,
37+
balanced (least open tickets), or sequentially (round-robin). Automatic
38+
assignment only works if users are assigned to the team. The responsible
39+
user is set automatically when creating or updating tickets, improving
40+
workflow and team efficiency.
41+
42+
**Table of contents**
43+
44+
.. contents::
45+
:local:
46+
47+
Usage
48+
=====
49+
50+
1. Go to *Helpdesk > Teams* and select or create a team.
51+
2. In the team form, choose the **Assignment Method**: Manual, Randomly,
52+
Balanced, or Sequential.
53+
3. Add users to the team (required for automatic assignment).
54+
4. Save the team.
55+
56+
When creating a new ticket (from Kanban or form view):
57+
58+
- Select the team for the ticket.
59+
60+
- The responsible user will be automatically assigned based on the
61+
team's assignment method:
62+
63+
- **Manual**: No automatic assignment; you must select the user
64+
manually.
65+
- **Randomly**: The ticket is assigned to a team member in a fair
66+
random order.
67+
- **Balanced**: The ticket is assigned to the user with the fewest
68+
open tickets.
69+
- **Sequential**: The ticket is assigned in round-robin order among
70+
team members.
71+
72+
Note:
73+
74+
- If no users are assigned to the team, only the manual method is
75+
available.
76+
- Changing the team on a ticket will re-trigger the assignment logic.
77+
78+
Bug Tracker
79+
===========
80+
81+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/helpdesk/issues>`_.
82+
In case of trouble, please check there if your issue has already been reported.
83+
If you spotted it first, help us to smash it by providing a detailed and welcomed
84+
`feedback <https://github.com/OCA/helpdesk/issues/new?body=module:%20helpdesk_mgmt_assign_method%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
85+
86+
Do not contact contributors directly about support or help with technical issues.
87+
88+
Credits
89+
=======
90+
91+
Authors
92+
-------
93+
94+
* Escodoo
95+
96+
Contributors
97+
------------
98+
99+
- `Escodoo <https://www.escodoo.com.br>`__:
100+
101+
- Marcel Savegnago <marcel.savegnago@escodoo.com.br>
102+
- Kaynnan Lemes <kaynnan.lemes@escodoo.com.br>
103+
104+
Maintainers
105+
-----------
106+
107+
This module is maintained by the OCA.
108+
109+
.. image:: https://odoo-community.org/logo.png
110+
:alt: Odoo Community Association
111+
:target: https://odoo-community.org
112+
113+
OCA, or the Odoo Community Association, is a nonprofit organization whose
114+
mission is to support the collaborative development of Odoo features and
115+
promote its widespread use.
116+
117+
This module is part of the `OCA/helpdesk <https://github.com/OCA/helpdesk/tree/19.0/helpdesk_mgmt_assign_method>`_ project on GitHub.
118+
119+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2025 - TODAY, Escodoo
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Helpdesk Mgmt Assign Method",
6+
"summary": """
7+
Helpdesk Assign Method""",
8+
"version": "19.0.1.0.0",
9+
"license": "AGPL-3",
10+
"category": "After-Sales",
11+
"author": "Escodoo, Odoo Community Association (OCA)",
12+
"website": "https://github.com/OCA/helpdesk",
13+
"depends": [
14+
"helpdesk_mgmt",
15+
],
16+
"data": [
17+
"views/helpdesk_ticket_team.xml",
18+
],
19+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * helpdesk_mgmt_assign_method
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 17.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: helpdesk_mgmt_assign_method
17+
#: model:ir.model.fields,field_description:helpdesk_mgmt_assign_method.field_helpdesk_ticket_team__assign_method
18+
msgid "Assignation Method"
19+
msgstr ""
20+
21+
#. module: helpdesk_mgmt_assign_method
22+
#: model:ir.model.fields,help:helpdesk_mgmt_assign_method.field_helpdesk_ticket_team__assign_method
23+
msgid ""
24+
"Automatic assignation method for new tickets:\n"
25+
"Manually: manual\n"
26+
"Randomly: randomly but everyone gets the same amount\n"
27+
"Balanced: to the person with the least amount of open tickets\n"
28+
"Sequential: ensuring an even distribution among team members"
29+
msgstr ""
30+
31+
#. module: helpdesk_mgmt_assign_method
32+
#: model:ir.model.fields.selection,name:helpdesk_mgmt_assign_method.selection__helpdesk_ticket_team__assign_method__balanced
33+
msgid "Balanced"
34+
msgstr ""
35+
36+
#. module: helpdesk_mgmt_assign_method
37+
#: model:ir.model,name:helpdesk_mgmt_assign_method.model_helpdesk_ticket
38+
msgid "Helpdesk Ticket"
39+
msgstr ""
40+
41+
#. module: helpdesk_mgmt_assign_method
42+
#: model:ir.model,name:helpdesk_mgmt_assign_method.model_helpdesk_ticket_team
43+
msgid "Helpdesk Ticket Team"
44+
msgstr ""
45+
46+
#. module: helpdesk_mgmt_assign_method
47+
#: model:ir.model.fields.selection,name:helpdesk_mgmt_assign_method.selection__helpdesk_ticket_team__assign_method__manual
48+
msgid "Manually"
49+
msgstr ""
50+
51+
#. module: helpdesk_mgmt_assign_method
52+
#: model:ir.model.fields.selection,name:helpdesk_mgmt_assign_method.selection__helpdesk_ticket_team__assign_method__randomly
53+
msgid "Randomly"
54+
msgstr ""
55+
56+
#. module: helpdesk_mgmt_assign_method
57+
#: model:ir.model.fields.selection,name:helpdesk_mgmt_assign_method.selection__helpdesk_ticket_team__assign_method__sequential
58+
msgid "Sequential"
59+
msgstr ""
60+
61+
#. module: helpdesk_mgmt_assign_method
62+
#. odoo-python
63+
#: code:addons/helpdesk_mgmt_assign_method/models/helpdesk_ticket_team.py:0
64+
#, python-format
65+
msgid "You must have team members assigned to change the assignation method."
66+
msgstr ""
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * helpdesk_mgmt_assign_method
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2025-11-21 12:42+0000\n"
10+
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
11+
"Language-Team: none\n"
12+
"Language: it\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 5.10.4\n"
18+
19+
#. module: helpdesk_mgmt_assign_method
20+
#: model:ir.model.fields,field_description:helpdesk_mgmt_assign_method.field_helpdesk_ticket_team__assign_method
21+
msgid "Assignation Method"
22+
msgstr "Metodo assegnazione"
23+
24+
#. module: helpdesk_mgmt_assign_method
25+
#: model:ir.model.fields,help:helpdesk_mgmt_assign_method.field_helpdesk_ticket_team__assign_method
26+
msgid ""
27+
"Automatic assignation method for new tickets:\n"
28+
"Manually: manual\n"
29+
"Randomly: randomly but everyone gets the same amount\n"
30+
"Balanced: to the person with the least amount of open tickets\n"
31+
"Sequential: ensuring an even distribution among team members"
32+
msgstr ""
33+
"Metodo di assegnazione automatica per i nuovi ticket:\n"
34+
"Manuale: manuale\n"
35+
"Casuale: in modo casuale, ma tutti ricevono la stessa quantità\n"
36+
"Bilanciato: alla persona con il minor numero di ticket aperti\n"
37+
"Sequenziale: per garantire una distribuzione uniforme tra i membri del team"
38+
39+
#. module: helpdesk_mgmt_assign_method
40+
#: model:ir.model.fields.selection,name:helpdesk_mgmt_assign_method.selection__helpdesk_ticket_team__assign_method__balanced
41+
msgid "Balanced"
42+
msgstr "Bilanciato"
43+
44+
#. module: helpdesk_mgmt_assign_method
45+
#: model:ir.model,name:helpdesk_mgmt_assign_method.model_helpdesk_ticket
46+
msgid "Helpdesk Ticket"
47+
msgstr "Ticket assistenza clienti"
48+
49+
#. module: helpdesk_mgmt_assign_method
50+
#: model:ir.model,name:helpdesk_mgmt_assign_method.model_helpdesk_ticket_team
51+
msgid "Helpdesk Ticket Team"
52+
msgstr "Team ticket assistenza clienti"
53+
54+
#. module: helpdesk_mgmt_assign_method
55+
#: model:ir.model.fields.selection,name:helpdesk_mgmt_assign_method.selection__helpdesk_ticket_team__assign_method__manual
56+
msgid "Manually"
57+
msgstr "Manualmente"
58+
59+
#. module: helpdesk_mgmt_assign_method
60+
#: model:ir.model.fields.selection,name:helpdesk_mgmt_assign_method.selection__helpdesk_ticket_team__assign_method__randomly
61+
msgid "Randomly"
62+
msgstr "A caso"
63+
64+
#. module: helpdesk_mgmt_assign_method
65+
#: model:ir.model.fields.selection,name:helpdesk_mgmt_assign_method.selection__helpdesk_ticket_team__assign_method__sequential
66+
msgid "Sequential"
67+
msgstr "Sequenziale"
68+
69+
#. module: helpdesk_mgmt_assign_method
70+
#. odoo-python
71+
#: code:addons/helpdesk_mgmt_assign_method/models/helpdesk_ticket_team.py:0
72+
#, python-format
73+
msgid "You must have team members assigned to change the assignation method."
74+
msgstr ""
75+
"Bisogna avere i membri dei team assegnati per modificare il metodo di "
76+
"assegnazione."
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import helpdesk_ticket_team
2+
from . import helpdesk_ticket
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright 2025 - TODAY, Kaynnan Lemes <kaynnan.lemes@escodoo.com.br>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, models
5+
6+
7+
class HelpdeskTicket(models.Model):
8+
_inherit = "helpdesk.ticket"
9+
10+
@api.model
11+
def default_get(self, fields_list):
12+
res = super().default_get(fields_list)
13+
team_id = res.get("team_id") or self.env.context.get("default_team_id")
14+
if not team_id:
15+
return res
16+
if "user_id" in res and "default_user_id" not in self.env.context:
17+
res.pop("user_id")
18+
if (not fields_list or "user_id" in fields_list) and "user_id" not in res:
19+
team = self.env["helpdesk.ticket.team"].browse(team_id)
20+
if team.assign_method != "manual":
21+
res["user_id"] = team.get_new_user().id
22+
return res
23+
24+
@api.onchange("team_id")
25+
def _onchange_team_id(self):
26+
"""Assign user when team changes if not already set."""
27+
if self.team_id and not self.user_id:
28+
self.user_id = self.team_id.get_new_user()
29+
30+
@api.model_create_multi
31+
def create(self, vals_list):
32+
"""Assign user based on team on creation if not provided."""
33+
for vals in vals_list:
34+
team_id = vals.get("team_id")
35+
if not team_id:
36+
continue
37+
team = self.env["helpdesk.ticket.team"].browse(team_id)
38+
user_id = vals.get("user_id")
39+
if user_id:
40+
if user_id not in team.user_ids.ids:
41+
if team.assign_method == "manual":
42+
vals["user_id"] = False
43+
else:
44+
vals["user_id"] = team.get_new_user().id
45+
elif team.assign_method != "manual":
46+
vals["user_id"] = team.get_new_user().id
47+
return super().create(vals_list)

0 commit comments

Comments
 (0)