[MIG] helpdesk_user_default_ticket_team: migrate to 18.0
This commit is contained in:
2
helpdesk_user_default_ticket_team/.gitignore
vendored
Normal file
2
helpdesk_user_default_ticket_team/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*.*~
|
||||||
|
*pyc
|
||||||
67
helpdesk_user_default_ticket_team/README.rst
Normal file
67
helpdesk_user_default_ticket_team/README.rst
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
=================================
|
||||||
|
helpdesk_user_default_ticket_team
|
||||||
|
=================================
|
||||||
|
|
||||||
|
Automate ticket team attribution when ticket created by portal user.
|
||||||
|
|
||||||
|
This module extends the ``helpdesk_mgmt`` module by allowing to configure a
|
||||||
|
default helpdesk team per user. It provides:
|
||||||
|
|
||||||
|
* A new ``default_helpdesk_ticket_team_id`` field on the user form, located in
|
||||||
|
the Preferences tab.
|
||||||
|
* Automatic team assignment when a ticket is created:
|
||||||
|
|
||||||
|
* If the ticket has no team assigned and has a linked partner.
|
||||||
|
* The module looks up the portal user associated with the partner.
|
||||||
|
* If the user has a default helpdesk team configured, it is automatically
|
||||||
|
assigned to the ticket.
|
||||||
|
* If the assigned team has a default project, the ticket is also linked to
|
||||||
|
that project.
|
||||||
|
|
||||||
|
This is particularly useful for multi-company or multi-team environments where
|
||||||
|
portal users should always have their tickets routed to a specific team.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
|
||||||
|
Use Odoo normal module installation procedure to install
|
||||||
|
``helpdesk_user_default_ticket_team``.
|
||||||
|
|
||||||
|
This module depends on:
|
||||||
|
|
||||||
|
* ``helpdesk_mgmt``: provides the base helpdesk ticket functionality.
|
||||||
|
* ``helpdesk_mgmt_project``: provides the link between tickets and projects.
|
||||||
|
|
||||||
|
Known issues / Roadmap
|
||||||
|
======================
|
||||||
|
|
||||||
|
None yet.
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
|
||||||
|
Bugs are tracked on `our issues website <https://git.elabore.coop/Elabore/helpdesk-tools/issues>`_. In case of
|
||||||
|
trouble, please check there if your issue has already been
|
||||||
|
reported. If you spotted it first, help us smashing it by providing a
|
||||||
|
detailed and welcomed feedback.
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Stéphan Sainléger - `Email <mailto:stephan.sainleger@elabore.coop>`_
|
||||||
|
|
||||||
|
Funders
|
||||||
|
-------
|
||||||
|
|
||||||
|
The development of this module has been financially supported by:
|
||||||
|
|
||||||
|
* Elabore (https://elabore.coop)
|
||||||
|
|
||||||
|
|
||||||
|
Maintainer
|
||||||
|
----------
|
||||||
|
|
||||||
|
This module is maintained by Elabore.
|
||||||
2
helpdesk_user_default_ticket_team/__init__.py
Normal file
2
helpdesk_user_default_ticket_team/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
from . import models
|
||||||
36
helpdesk_user_default_ticket_team/__manifest__.py
Normal file
36
helpdesk_user_default_ticket_team/__manifest__.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Copyright 2022 Stéphan Sainléger (Elabore)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "helpdesk_user_default_ticket_team",
|
||||||
|
"version": "18.0.1.0.0",
|
||||||
|
"author": "Elabore",
|
||||||
|
"website": "https://elabore.coop",
|
||||||
|
"maintainer": "Stéphan Sainléger",
|
||||||
|
"license": "AGPL-3",
|
||||||
|
"category": "Tools",
|
||||||
|
"summary": "Automate ticket team attribution when ticket created by portal user.",
|
||||||
|
# any module necessary for this one to work correctly
|
||||||
|
"depends": [
|
||||||
|
"base",
|
||||||
|
"helpdesk_mgmt",
|
||||||
|
"helpdesk_mgmt_project",
|
||||||
|
],
|
||||||
|
"qweb": [],
|
||||||
|
"external_dependencies": {
|
||||||
|
"python": [],
|
||||||
|
},
|
||||||
|
# always loaded
|
||||||
|
"data": [
|
||||||
|
"views/res_users_views.xml",
|
||||||
|
],
|
||||||
|
# only loaded in demonstration mode
|
||||||
|
"demo": [],
|
||||||
|
"js": [],
|
||||||
|
"css": [],
|
||||||
|
"installable": True,
|
||||||
|
# Install this module automatically if all dependency have been previously
|
||||||
|
# and independently installed. Used for synergetic or glue modules.
|
||||||
|
"auto_install": False,
|
||||||
|
"application": False,
|
||||||
|
}
|
||||||
1
helpdesk_user_default_ticket_team/i18n/README
Normal file
1
helpdesk_user_default_ticket_team/i18n/README
Normal file
@@ -0,0 +1 @@
|
|||||||
|
This directory should contain the *.po for Odoo translation.
|
||||||
31
helpdesk_user_default_ticket_team/i18n/fr.po
Normal file
31
helpdesk_user_default_ticket_team/i18n/fr.po
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * helpdesk_user_default_ticket_team
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 16.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2025-05-21 14:37+0000\n"
|
||||||
|
"PO-Revision-Date: 2025-05-21 16:39+0200\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: \n"
|
||||||
|
"Plural-Forms: \n"
|
||||||
|
|
||||||
|
#. module: helpdesk_user_default_ticket_team
|
||||||
|
#: model:ir.model.fields,field_description:helpdesk_user_default_ticket_team.field_res_users__default_helpdesk_ticket_team_id
|
||||||
|
msgid "Default Helpdesk Team"
|
||||||
|
msgstr "Équipe d'assistance par défaut"
|
||||||
|
|
||||||
|
#. module: helpdesk_user_default_ticket_team
|
||||||
|
#: model:ir.model,name:helpdesk_user_default_ticket_team.model_helpdesk_ticket
|
||||||
|
msgid "Helpdesk Ticket"
|
||||||
|
msgstr "Ticket d'assistance"
|
||||||
|
|
||||||
|
#. module: helpdesk_user_default_ticket_team
|
||||||
|
#: model:ir.model,name:helpdesk_user_default_ticket_team.model_res_users
|
||||||
|
msgid "User"
|
||||||
|
msgstr "Utilisateur"
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * helpdesk_user_default_ticket_team
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 16.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2025-05-21 14:36+0000\n"
|
||||||
|
"PO-Revision-Date: 2025-05-21 14:36+0000\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: \n"
|
||||||
|
"Plural-Forms: \n"
|
||||||
|
|
||||||
|
#. module: helpdesk_user_default_ticket_team
|
||||||
|
#: model:ir.model.fields,field_description:helpdesk_user_default_ticket_team.field_res_users__default_helpdesk_ticket_team_id
|
||||||
|
msgid "Default Helpdesk Team"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: helpdesk_user_default_ticket_team
|
||||||
|
#: model:ir.model,name:helpdesk_user_default_ticket_team.model_helpdesk_ticket
|
||||||
|
msgid "Helpdesk Ticket"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: helpdesk_user_default_ticket_team
|
||||||
|
#: model:ir.model,name:helpdesk_user_default_ticket_team.model_res_users
|
||||||
|
msgid "User"
|
||||||
|
msgstr ""
|
||||||
2
helpdesk_user_default_ticket_team/models/__init__.py
Normal file
2
helpdesk_user_default_ticket_team/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
from . import res_users
|
||||||
|
from . import helpdesk_ticket
|
||||||
30
helpdesk_user_default_ticket_team/models/helpdesk_ticket.py
Normal file
30
helpdesk_user_default_ticket_team/models/helpdesk_ticket.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
from odoo import api, models
|
||||||
|
|
||||||
|
|
||||||
|
class HelpdeskTicket(models.Model):
|
||||||
|
_inherit = "helpdesk.ticket"
|
||||||
|
|
||||||
|
@api.model_create_multi
|
||||||
|
def create(self, vals_list):
|
||||||
|
for vals in vals_list:
|
||||||
|
if not vals.get("team_id") and vals.get("partner_id"):
|
||||||
|
# Find the user who creates the ticket
|
||||||
|
partner = self.env["res.partner"].browse(vals.get("partner_id"))
|
||||||
|
if not partner:
|
||||||
|
continue
|
||||||
|
user = self.env["res.users"].browse(partner.user_ids[0].id)
|
||||||
|
if not user:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Get its default team_id
|
||||||
|
team = user.default_helpdesk_ticket_team_id
|
||||||
|
if not team:
|
||||||
|
continue
|
||||||
|
|
||||||
|
vals["team_id"] = team.id
|
||||||
|
|
||||||
|
# Set the linked project
|
||||||
|
if team.default_project_id:
|
||||||
|
vals["project_id"] = team.default_project_id.id
|
||||||
|
|
||||||
|
return super().create(vals_list)
|
||||||
9
helpdesk_user_default_ticket_team/models/res_users.py
Normal file
9
helpdesk_user_default_ticket_team/models/res_users.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class Users(models.Model):
|
||||||
|
_inherit = "res.users"
|
||||||
|
|
||||||
|
default_helpdesk_ticket_team_id = fields.Many2one(
|
||||||
|
"helpdesk.ticket.team", string="Default Helpdesk Team"
|
||||||
|
)
|
||||||
15
helpdesk_user_default_ticket_team/views/res_users_views.xml
Normal file
15
helpdesk_user_default_ticket_team/views/res_users_views.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<odoo>
|
||||||
|
<record id="view_users_form_inherit_default_helpdesk_team" model="ir.ui.view">
|
||||||
|
<field name="name">view.users.form.inherit.default.helpdesk.team</field>
|
||||||
|
<field name="model">res.users</field>
|
||||||
|
<field name="inherit_id" ref="base.view_users_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//page[@name='preferences']" position="inside">
|
||||||
|
<group name="helpdesk_user_default">
|
||||||
|
<field name="default_helpdesk_ticket_team_id" />
|
||||||
|
</group>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user