From d2a93f2bf50468cc89088735a1e7b79011ef31bf Mon Sep 17 00:00:00 2001 From: dessanhemrayev Date: Thu, 8 Aug 2024 22:16:41 +0300 Subject: [PATCH] [FIX] helpdesk_mgmt_templates: fix bugs on UI Add new field for categories in ticket for domain in UI Remove the editable bottom for Categories Tree View and add Form view for categories to improve UX creating big templates. --- helpdesk_mgmt_templates/__manifest__.py | 5 ++++- .../models/helpdesk_ticket.py | 8 ++++++++ .../views/helpdesk_ticket_category_views.xml | 7 ++++--- .../views/helpdesk_ticket_views.xml | 19 +++++++++++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 helpdesk_mgmt_templates/views/helpdesk_ticket_views.xml diff --git a/helpdesk_mgmt_templates/__manifest__.py b/helpdesk_mgmt_templates/__manifest__.py index c0a4cf4eb..f6d1208c0 100644 --- a/helpdesk_mgmt_templates/__manifest__.py +++ b/helpdesk_mgmt_templates/__manifest__.py @@ -9,6 +9,9 @@ "author": "Cetmix OÜ, Odoo Community Association (OCA)", "website": "https://github.com/OCA/helpdesk", "depends": ["helpdesk_mgmt"], - "data": ["views/helpdesk_ticket_category_views.xml"], + "data": [ + "views/helpdesk_ticket_views.xml", + "views/helpdesk_ticket_category_views.xml", + ], "application": False, } diff --git a/helpdesk_mgmt_templates/models/helpdesk_ticket.py b/helpdesk_mgmt_templates/models/helpdesk_ticket.py index b00bf2782..787614b62 100644 --- a/helpdesk_mgmt_templates/models/helpdesk_ticket.py +++ b/helpdesk_mgmt_templates/models/helpdesk_ticket.py @@ -9,6 +9,14 @@ class HelpdeskTicket(models.Model): _inherit = "helpdesk.ticket" description = fields.Html(store=True, compute="_compute_description") + helpdesk_ticket_category_ids = fields.Many2many( + "helpdesk.ticket.category", compute="_compute_helpdesk_ticket_category" + ) + + @api.depends("team_id") + def _compute_helpdesk_ticket_category(self): + for rec in self: + rec.helpdesk_ticket_category_ids = rec.team_id.category_ids.ids @api.depends("category_id") def _compute_description(self): diff --git a/helpdesk_mgmt_templates/views/helpdesk_ticket_category_views.xml b/helpdesk_mgmt_templates/views/helpdesk_ticket_category_views.xml index a7460cd25..2b136d921 100644 --- a/helpdesk_mgmt_templates/views/helpdesk_ticket_category_views.xml +++ b/helpdesk_mgmt_templates/views/helpdesk_ticket_category_views.xml @@ -4,10 +4,11 @@ view.helpdesk_category.tree helpdesk.ticket.category + 99 - - - + + + diff --git a/helpdesk_mgmt_templates/views/helpdesk_ticket_views.xml b/helpdesk_mgmt_templates/views/helpdesk_ticket_views.xml new file mode 100644 index 000000000..8695c6b95 --- /dev/null +++ b/helpdesk_mgmt_templates/views/helpdesk_ticket_views.xml @@ -0,0 +1,19 @@ + + + + helpdesk.ticket.view.form + helpdesk.ticket + + 99 + + + + + + [('id', 'in', helpdesk_ticket_category_ids)] + + + +