[ADD] helpdesk_user_default_ticket_team: create add-on

This commit is contained in:
Stéphan Sainléger
2025-05-21 16:53:54 +02:00
committed by Stéphan Sainléger
parent 28ae6f5572
commit 5f74000f5c
11 changed files with 191 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
*.*~
*pyc

View File

@@ -0,0 +1,46 @@
=================================
helpdesk_user_default_ticket_team
=================================
Automate ticket team attribution when ticket created by portal user.
- configure default team on portal user form view
- assign automatically the new tickets to the team configured in the user's profile.
Installation
============
Use Odoo normal module installation procedure to install
``helpdesk_user_default_ticket_team``.
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/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
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

View File

@@ -0,0 +1,35 @@
# 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": "16.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",
],
"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,
}

View File

@@ -0,0 +1 @@
This directory should contain the *.po for Odoo translation.

View 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"

View 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: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 ""

View File

@@ -0,0 +1,2 @@
from . import res_users
from . import helpdesk_ticket

View File

@@ -0,0 +1,19 @@
from odoo import api, fields, models, tools
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"):
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
if user.default_helpdesk_ticket_team_id:
vals["team_id"] = user.default_helpdesk_ticket_team_id.id
return super().create(vals_list)

View File

@@ -0,0 +1,6 @@
from odoo import _, api, fields, models
class Users(models.Model):
_inherit = "res.users"
default_helpdesk_ticket_team_id = fields.Many2one('helpdesk.ticket.team', string='Default Helpdesk Team')

View 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>