From 3b4292401af77a51d6c8d9f2ff5a10db1a8ca1a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ba=C3=B1=C3=B3n?= Date: Mon, 25 May 2026 11:53:05 +0200 Subject: [PATCH 1/3] [IMP] helpdesk_product: Improve ux --- helpdesk_product/README.rst | 7 ++- helpdesk_product/models/helpdesk_ticket.py | 6 +- helpdesk_product/models/product.py | 59 +++++++++++++++++-- helpdesk_product/readme/CONTRIBUTORS.md | 2 + helpdesk_product/readme/DESCRIPTION.md | 2 +- .../static/description/index.html | 7 ++- helpdesk_product/views/product_view.xml | 15 +++++ 7 files changed, 90 insertions(+), 8 deletions(-) diff --git a/helpdesk_product/README.rst b/helpdesk_product/README.rst index ff36f2476d..da7a87b37f 100644 --- a/helpdesk_product/README.rst +++ b/helpdesk_product/README.rst @@ -32,7 +32,8 @@ Helpdesk Product |badge1| |badge2| |badge3| |badge4| |badge5| -This module adds the option to select product in the helpdesk tickets. +This module adds the option to select product in the helpdesk tickets +and view tickets related to products. **Table of contents** @@ -64,6 +65,10 @@ Contributors - Maria Buscallà +- `Tecnativa `__: + + - David Bañón Gil + Maintainers ----------- diff --git a/helpdesk_product/models/helpdesk_ticket.py b/helpdesk_product/models/helpdesk_ticket.py index 26c91e2dbc..5c7775c50e 100644 --- a/helpdesk_product/models/helpdesk_ticket.py +++ b/helpdesk_product/models/helpdesk_ticket.py @@ -4,4 +4,8 @@ class HelpdeskTicket(models.Model): _inherit = "helpdesk.ticket" - product_id = fields.Many2one(string="Product", comodel_name="product.product") + product_id = fields.Many2one( + string="Product", + comodel_name="product.product", + domain=[("ticket_active", "=", True)], + ) diff --git a/helpdesk_product/models/product.py b/helpdesk_product/models/product.py index fa4ec4f15a..586ef95648 100644 --- a/helpdesk_product/models/product.py +++ b/helpdesk_product/models/product.py @@ -1,9 +1,60 @@ -from odoo import fields, models +from odoo import api, fields, models -class Product(models.Model): +class ProductTemplate(models.Model): _inherit = "product.template" - ticket_active = fields.Boolean( - "Available for Helpdesk Tickets", default=True, required=True + ticket_active = fields.Boolean("Available for Helpdesk Tickets", default=True) + helpdesk_ticket_ids = fields.One2many( + related="product_variant_ids.helpdesk_ticket_ids" ) + helpdesk_ticket_count = fields.Integer(compute="_compute_helpdesk_ticket_count") + + @api.depends("helpdesk_ticket_ids") + def _compute_helpdesk_ticket_count(self): + for template in self: + template.helpdesk_ticket_count = len(template.helpdesk_ticket_ids) + + def action_view_helpdesk_tickets(self, product=None): + product = product or self + product.ensure_one() + action = self.env["ir.actions.actions"]._for_xml_id( + "helpdesk_mgmt.helpdesk_ticket_action" + ) + if product.helpdesk_ticket_count <= 1: + ticket = product.helpdesk_ticket_ids + product_id = False + if product.is_product_variant or len(product.product_variant_ids) == 1: + product_id = product.product_variant_id.id + action.update( + { + "res_id": ticket.id, + "views": [(False, "form")], + "context": {"default_product_id": product_id}, + } + ) + else: + action.update( + { + "domain": [("id", "in", product.helpdesk_ticket_ids.ids)], + } + ) + return action + + +class ProductProduct(models.Model): + _inherit = "product.product" + + helpdesk_ticket_ids = fields.One2many( + comodel_name="helpdesk.ticket", inverse_name="product_id" + ) + helpdesk_ticket_count = fields.Integer(compute="_compute_helpdesk_ticket_count") + + @api.depends("helpdesk_ticket_ids") + def _compute_helpdesk_ticket_count(self): + for template in self: + template.helpdesk_ticket_count = len(template.helpdesk_ticket_ids) + + def action_view_helpdesk_tickets(self): + self.ensure_one() + return self.product_tmpl_id.action_view_helpdesk_tickets(product=self) diff --git a/helpdesk_product/readme/CONTRIBUTORS.md b/helpdesk_product/readme/CONTRIBUTORS.md index 109df4a27e..2dfe37499b 100644 --- a/helpdesk_product/readme/CONTRIBUTORS.md +++ b/helpdesk_product/readme/CONTRIBUTORS.md @@ -1,2 +1,4 @@ - [ForgeFlow](https://www.forgeflow.com): - Maria Buscallà \<\> +- [Tecnativa](https://www.tecnativa.com): + - David Bañón Gil diff --git a/helpdesk_product/readme/DESCRIPTION.md b/helpdesk_product/readme/DESCRIPTION.md index 522e1c55dc..4cc1973e01 100644 --- a/helpdesk_product/readme/DESCRIPTION.md +++ b/helpdesk_product/readme/DESCRIPTION.md @@ -1 +1 @@ -This module adds the option to select product in the helpdesk tickets. +This module adds the option to select product in the helpdesk tickets and view tickets related to products. diff --git a/helpdesk_product/static/description/index.html b/helpdesk_product/static/description/index.html index 757fa5c837..d44bb2e792 100644 --- a/helpdesk_product/static/description/index.html +++ b/helpdesk_product/static/description/index.html @@ -375,7 +375,8 @@

Helpdesk Product

!! source digest: sha256:50b627b43f4db5e3056ce7640b144b1608c52a100c6a0505ba0f4a1f9cd64144 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/helpdesk Translate me on Weblate Try me on Runboat

-

This module adds the option to select product in the helpdesk tickets.

+

This module adds the option to select product in the helpdesk tickets +and view tickets related to products.

Table of contents

+
  • Tecnativa:
      +
    • David Bañón Gil
    • +
    +
  • diff --git a/helpdesk_product/views/product_view.xml b/helpdesk_product/views/product_view.xml index 2aa785269e..54dd8acb0e 100644 --- a/helpdesk_product/views/product_view.xml +++ b/helpdesk_product/views/product_view.xml @@ -12,6 +12,21 @@
    +
    + +
    From 4c1f42f20b5a82abc6b861c90b81ea70e4fae542 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Mon, 15 Jun 2026 10:06:01 +0000 Subject: [PATCH 2/3] [UPD] Update helpdesk_product.pot --- helpdesk_product/i18n/helpdesk_product.pot | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/helpdesk_product/i18n/helpdesk_product.pot b/helpdesk_product/i18n/helpdesk_product.pot index b315829c05..b1449edaeb 100644 --- a/helpdesk_product/i18n/helpdesk_product.pot +++ b/helpdesk_product/i18n/helpdesk_product.pot @@ -31,6 +31,7 @@ msgstr "" #. module: helpdesk_product #: model:ir.model.fields,field_description:helpdesk_product.field_helpdesk_ticket__display_name +#: model:ir.model.fields,field_description:helpdesk_product.field_product_product__display_name #: model:ir.model.fields,field_description:helpdesk_product.field_product_template__display_name msgid "Display Name" msgstr "" @@ -42,11 +43,20 @@ msgstr "" #. module: helpdesk_product #: model:ir.model,name:helpdesk_product.model_helpdesk_ticket +#: model:ir.model.fields,field_description:helpdesk_product.field_product_product__helpdesk_ticket_ids +#: model:ir.model.fields,field_description:helpdesk_product.field_product_template__helpdesk_ticket_ids msgid "Helpdesk Ticket" msgstr "" +#. module: helpdesk_product +#: model:ir.model.fields,field_description:helpdesk_product.field_product_product__helpdesk_ticket_count +#: model:ir.model.fields,field_description:helpdesk_product.field_product_template__helpdesk_ticket_count +msgid "Helpdesk Ticket Count" +msgstr "" + #. module: helpdesk_product #: model:ir.model.fields,field_description:helpdesk_product.field_helpdesk_ticket__id +#: model:ir.model.fields,field_description:helpdesk_product.field_product_product__id #: model:ir.model.fields,field_description:helpdesk_product.field_product_template__id msgid "ID" msgstr "" @@ -63,12 +73,22 @@ msgstr "" msgid "Product Related" msgstr "" +#. module: helpdesk_product +#: model:ir.model,name:helpdesk_product.model_product_product +msgid "Product Variant" +msgstr "" + #. module: helpdesk_product #: model:ir.actions.act_window,name:helpdesk_product.product_template_action_helpdesk #: model:ir.ui.menu,name:helpdesk_product.action_menu_view_products msgid "Products" msgstr "" +#. module: helpdesk_product +#: model_terms:ir.ui.view,arch_db:helpdesk_product.product_view_template +msgid "Tickets" +msgstr "" + #. module: helpdesk_product #: model_terms:ir.actions.act_window,help:helpdesk_product.product_template_action_helpdesk msgid "" From bba9e37ccb036d923387ace3e19304779da5e883 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 15 Jun 2026 10:09:03 +0000 Subject: [PATCH 3/3] [BOT] post-merge updates --- README.md | 2 +- helpdesk_product/README.rst | 2 +- helpdesk_product/__manifest__.py | 2 +- helpdesk_product/static/description/index.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ea09ba914d..c7b24d31a4 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Available addons addon | version | maintainers | summary --- | --- | --- | --- [helpdesk_mgmt](helpdesk_mgmt/) | 19.0.1.1.0 | | Helpdesk -[helpdesk_product](helpdesk_product/) | 19.0.1.0.0 | | Add the option to select product in the tickets. +[helpdesk_product](helpdesk_product/) | 19.0.1.1.0 | | Add the option to select product in the tickets. [helpdesk_type](helpdesk_type/) | 19.0.1.0.0 | nelsonramirezs max3903 | Add a type to your tickets [//]: # (end addons) diff --git a/helpdesk_product/README.rst b/helpdesk_product/README.rst index da7a87b37f..614e7d1ed1 100644 --- a/helpdesk_product/README.rst +++ b/helpdesk_product/README.rst @@ -11,7 +11,7 @@ Helpdesk Product !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:50b627b43f4db5e3056ce7640b144b1608c52a100c6a0505ba0f4a1f9cd64144 + !! source digest: sha256:871dc4aaee4934cf5c8c6d2689ad675d01f2799c9bb6154efda0102cd81231c3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/helpdesk_product/__manifest__.py b/helpdesk_product/__manifest__.py index acd20c79a6..e1e108378b 100644 --- a/helpdesk_product/__manifest__.py +++ b/helpdesk_product/__manifest__.py @@ -2,7 +2,7 @@ "name": "Helpdesk Product", "summary": "Add the option to select product in the tickets.", "author": "ForgeFlow, Odoo Community Association (OCA)", - "version": "19.0.1.0.0", + "version": "19.0.1.1.0", "license": "AGPL-3", "category": "After-Sales", "website": "https://github.com/OCA/helpdesk", diff --git a/helpdesk_product/static/description/index.html b/helpdesk_product/static/description/index.html index d44bb2e792..512fdcea69 100644 --- a/helpdesk_product/static/description/index.html +++ b/helpdesk_product/static/description/index.html @@ -372,7 +372,7 @@

    Helpdesk Product

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:50b627b43f4db5e3056ce7640b144b1608c52a100c6a0505ba0f4a1f9cd64144 +!! source digest: sha256:871dc4aaee4934cf5c8c6d2689ad675d01f2799c9bb6154efda0102cd81231c3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

    Beta License: AGPL-3 OCA/helpdesk Translate me on Weblate Try me on Runboat

    This module adds the option to select product in the helpdesk tickets