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)] + + + +