diff --git a/helpdesk_ticket_related_tickets/README.rst b/helpdesk_ticket_related_tickets/README.rst new file mode 100644 index 0000000000..fe7fcfd5b8 --- /dev/null +++ b/helpdesk_ticket_related_tickets/README.rst @@ -0,0 +1,87 @@ +=============================== +Helpdesk Ticket Related Tickets +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:50d6fda3c9d6fdf6c65c5bb7576247306f181bb9a3040943ee3b6a9a7f73f55d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhelpdesk-lightgray.png?logo=github + :target: https://github.com/OCA/helpdesk/tree/16.0/helpdesk_ticket_related_tickets + :alt: OCA/helpdesk +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/helpdesk-16-0/helpdesk-16-0-helpdesk_ticket_related_tickets + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/helpdesk&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Link tickets to each other to have a more complete traceability + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Antoni Marroig +* APSL-Nagarro + +Contributors +------------ + +[APSL-Nagarro](https://apsl.tech): + +- Antoni Marroig + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-peluko00| image:: https://github.com/peluko00.png?size=40px + :target: https://github.com/peluko00 + :alt: peluko00 + +Current `maintainer `__: + +|maintainer-peluko00| + +This module is part of the `OCA/helpdesk `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/helpdesk_ticket_related_tickets/__init__.py b/helpdesk_ticket_related_tickets/__init__.py new file mode 100644 index 0000000000..31660d6a96 --- /dev/null +++ b/helpdesk_ticket_related_tickets/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/helpdesk_ticket_related_tickets/__manifest__.py b/helpdesk_ticket_related_tickets/__manifest__.py new file mode 100644 index 0000000000..784494bb79 --- /dev/null +++ b/helpdesk_ticket_related_tickets/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2024 Antoni Marroig(APSL-Nagarro) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Helpdesk Ticket Related Tickets", + "summary": "Link tickets to each other", + "version": "16.0.1.0.0", + "category": "Helpdesk", + "website": "https://github.com/OCA/helpdesk", + "author": "Antoni Marroig, APSL-Nagarro, Odoo Community Association (OCA)", + "maintainers": ["peluko00"], + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "helpdesk_mgmt", + ], + "data": [ + "views/helpdesk_ticket_views.xml", + ], +} diff --git a/helpdesk_ticket_related_tickets/i18n/ca.po b/helpdesk_ticket_related_tickets/i18n/ca.po new file mode 100644 index 0000000000..d154ea7575 --- /dev/null +++ b/helpdesk_ticket_related_tickets/i18n/ca.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * helpdesk_ticket_related_tickets +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-01-08 12:44+0000\n" +"PO-Revision-Date: 2025-01-08 12:44+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_ticket_related_tickets +#: model:ir.model,name:helpdesk_ticket_related_tickets.model_helpdesk_ticket +msgid "Helpdesk Ticket" +msgstr "Tiquet del centre d'assitència" + +#. module: helpdesk_ticket_related_tickets +#: model_terms:ir.ui.view,arch_db:helpdesk_ticket_related_tickets.view_helpdesk_ticket_form_inherit +msgid "Open" +msgstr "Obrir" + +#. module: helpdesk_ticket_related_tickets +#: model:ir.model.fields,field_description:helpdesk_ticket_related_tickets.field_helpdesk_ticket__related_ticket_ids +#: model_terms:ir.ui.view,arch_db:helpdesk_ticket_related_tickets.view_helpdesk_ticket_form_inherit +msgid "Related tickets" +msgstr "Tiquets relacionats" diff --git a/helpdesk_ticket_related_tickets/i18n/es.po b/helpdesk_ticket_related_tickets/i18n/es.po new file mode 100644 index 0000000000..0af8266191 --- /dev/null +++ b/helpdesk_ticket_related_tickets/i18n/es.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * helpdesk_ticket_related_tickets +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-01-08 12:44+0000\n" +"PO-Revision-Date: 2025-01-08 12:44+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_ticket_related_tickets +#: model:ir.model,name:helpdesk_ticket_related_tickets.model_helpdesk_ticket +msgid "Helpdesk Ticket" +msgstr "Ticket Helpdesk" + +#. module: helpdesk_ticket_related_tickets +#: model_terms:ir.ui.view,arch_db:helpdesk_ticket_related_tickets.view_helpdesk_ticket_form_inherit +msgid "Open" +msgstr "Abrir" + +#. module: helpdesk_ticket_related_tickets +#: model:ir.model.fields,field_description:helpdesk_ticket_related_tickets.field_helpdesk_ticket__related_ticket_ids +#: model_terms:ir.ui.view,arch_db:helpdesk_ticket_related_tickets.view_helpdesk_ticket_form_inherit +msgid "Related tickets" +msgstr "Tickets relacionados" diff --git a/helpdesk_ticket_related_tickets/models/__init__.py b/helpdesk_ticket_related_tickets/models/__init__.py new file mode 100644 index 0000000000..4ca3b4c102 --- /dev/null +++ b/helpdesk_ticket_related_tickets/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import helpdesk_ticket diff --git a/helpdesk_ticket_related_tickets/models/helpdesk_ticket.py b/helpdesk_ticket_related_tickets/models/helpdesk_ticket.py new file mode 100644 index 0000000000..92678351e8 --- /dev/null +++ b/helpdesk_ticket_related_tickets/models/helpdesk_ticket.py @@ -0,0 +1,39 @@ +# Copyright 2024 Antoni Marroig(APSL-Nagarro) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class HelpdeskTicket(models.Model): + _inherit = "helpdesk.ticket" + + related_ticket_ids = fields.Many2many( + "helpdesk.ticket", + "ticket_relationship_table", + "ticket_id1", + "ticket_id2", + string="Related tickets", + ) + + def write(self, vals): + if "related_ticket_ids" in vals: + for ticket in self.related_ticket_ids: + if ( + 6 == vals.get("related_ticket_ids")[0][0] + and ticket.id not in vals.get("related_ticket_ids")[0][2] + ): + ticket.write({"related_ticket_ids": [(3, self.id)]}) + res = super().write(vals) + if "related_ticket_ids" in vals: + for rel_ticket in self.related_ticket_ids: + if self._origin.id not in rel_ticket.related_ticket_ids.ids: + rel_ticket.write({"related_ticket_ids": [(4, self.id)]}) + return res + + def open_ticket(self): + return { + "type": "ir.actions.act_window", + "view_mode": "form", + "res_model": "helpdesk.ticket", + "res_id": self.id, + } diff --git a/helpdesk_ticket_related_tickets/readme/CONTRIBUTORS.md b/helpdesk_ticket_related_tickets/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..ce96c12a15 --- /dev/null +++ b/helpdesk_ticket_related_tickets/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +\[APSL-Nagarro\](): + - Antoni Marroig \<\> diff --git a/helpdesk_ticket_related_tickets/readme/DESCRIPTION.md b/helpdesk_ticket_related_tickets/readme/DESCRIPTION.md new file mode 100644 index 0000000000..a581ba5cab --- /dev/null +++ b/helpdesk_ticket_related_tickets/readme/DESCRIPTION.md @@ -0,0 +1 @@ +Link tickets to each other to have a more complete traceability diff --git a/helpdesk_ticket_related_tickets/static/description/icon.png b/helpdesk_ticket_related_tickets/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/helpdesk_ticket_related_tickets/static/description/icon.png differ diff --git a/helpdesk_ticket_related_tickets/static/description/icon.svg b/helpdesk_ticket_related_tickets/static/description/icon.svg new file mode 100644 index 0000000000..a7a26d0932 --- /dev/null +++ b/helpdesk_ticket_related_tickets/static/description/icon.svg @@ -0,0 +1,79 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/helpdesk_ticket_related_tickets/static/description/index.html b/helpdesk_ticket_related_tickets/static/description/index.html new file mode 100644 index 0000000000..f92d18ab8d --- /dev/null +++ b/helpdesk_ticket_related_tickets/static/description/index.html @@ -0,0 +1,124 @@ +
+
+
+

Module name

+

This module was written to extend the functionality of ... to support ... and allow you to ...

+
+
+
+ +
+
+
+

Installation

+
+
+

To install this module, you need to: +

    +
  • ...
  • +
+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Configuration

+
+
+

To configure this module, you need to: +

    +
  • ...
  • +
+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Usage

+
+
+

To use this module, you need to: +

    +
  • ...
  • +
+

+

For further information, please visit: +

+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Known issues / Roadmap

+
+
+

+

    +
  • ...
  • +
+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Credits

+
+
+

Contributors

+ +
+
+

Maintainer

+

+ This module is maintained by the OCA.
+ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
+ To contribute to this module, please visit http://odoo-community.org.
+ +

+
+
+
diff --git a/helpdesk_ticket_related_tickets/tests/__init__.py b/helpdesk_ticket_related_tickets/tests/__init__.py new file mode 100644 index 0000000000..9a6a43dae3 --- /dev/null +++ b/helpdesk_ticket_related_tickets/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import test_related_tickets diff --git a/helpdesk_ticket_related_tickets/tests/test_related_tickets.py b/helpdesk_ticket_related_tickets/tests/test_related_tickets.py new file mode 100644 index 0000000000..8dcf301a83 --- /dev/null +++ b/helpdesk_ticket_related_tickets/tests/test_related_tickets.py @@ -0,0 +1,32 @@ +# Copyright 2024 Antoni Marroig(APSL-Nagarro) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class HelpdeskTicketRelatedTickets(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.ticket1 = cls.env.ref("helpdesk_mgmt.helpdesk_ticket_1") + cls.ticket2 = cls.env.ref("helpdesk_mgmt.helpdesk_ticket_2") + + def test_link_tickets(self): + self.ticket1.related_ticket_ids = [(4, self.ticket2.id)] + self.assertEqual(self.ticket2.related_ticket_ids, self.ticket1) + + def test_unlink_tickets(self): + self.ticket1.related_ticket_ids = [(4, self.ticket2.id)] + self.ticket1.related_ticket_ids = [[6, False, []]] + self.assertEqual(self.ticket2.related_ticket_ids.ids, []) + + def test_open_ticket(self): + self.assertEqual( + self.ticket1.open_ticket(), + { + "type": "ir.actions.act_window", + "view_mode": "form", + "res_model": "helpdesk.ticket", + "res_id": self.ticket1.id, + }, + ) diff --git a/helpdesk_ticket_related_tickets/views/helpdesk_ticket_views.xml b/helpdesk_ticket_related_tickets/views/helpdesk_ticket_views.xml new file mode 100644 index 0000000000..3ca3f6c027 --- /dev/null +++ b/helpdesk_ticket_related_tickets/views/helpdesk_ticket_views.xml @@ -0,0 +1,24 @@ + + + + helpdesk.ticket.form.inherit + helpdesk.ticket + + + + + + + + + + +