Skip to content

Commit

Permalink
[ADD] helpdesk_ticket_related_tickets: New module helpdesk_ticket_rel…
Browse files Browse the repository at this point in the history
…ated_tickets
  • Loading branch information
peluko00 committed Jan 14, 2025
1 parent 0b9891c commit 71fffd4
Show file tree
Hide file tree
Showing 17 changed files with 488 additions and 0 deletions.
87 changes: 87 additions & 0 deletions helpdesk_ticket_related/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
=======================
Helpdesk Ticket Related
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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
: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
: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 <https://github.com/OCA/helpdesk/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 <https://github.com/OCA/helpdesk/issues/new?body=module:%20helpdesk_ticket_related%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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 <[email protected]>

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 <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-peluko00|

This module is part of the `OCA/helpdesk <https://github.com/OCA/helpdesk/tree/16.0/helpdesk_ticket_related>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions helpdesk_ticket_related/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
20 changes: 20 additions & 0 deletions helpdesk_ticket_related/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Helpdesk Ticket Related",
"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",
],
}
32 changes: 32 additions & 0 deletions helpdesk_ticket_related/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -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"
32 changes: 32 additions & 0 deletions helpdesk_ticket_related/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 3 additions & 0 deletions helpdesk_ticket_related/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import helpdesk_ticket
39 changes: 39 additions & 0 deletions helpdesk_ticket_related/models/helpdesk_ticket.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<[email protected]>
# 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,
}
2 changes: 2 additions & 0 deletions helpdesk_ticket_related/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
\[APSL-Nagarro\](<https://apsl.tech>):
- Antoni Marroig \<<[email protected]>\>
1 change: 1 addition & 0 deletions helpdesk_ticket_related/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Link tickets to each other to have a more complete traceability
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions helpdesk_ticket_related/static/description/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 124 additions & 0 deletions helpdesk_ticket_related/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Module name</h2>
<p>This module was written to extend the functionality of ... to support ... and allow you to ...</p>
</div>
</div>
</section>

<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Installation</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">To install this module, you need to:
<ul>
<li>...</li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>

<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Configuration</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">To configure this module, you need to:
<ul>
<li>...</li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>

<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Usage</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">To use this module, you need to:
<ul>
<li>...</li>
</ul>
</p>
<p class="oe_mt32">For further information, please visit:
<ul>
<li><a href="https://www.odoo.com/forum/help-1">https://www.odoo.com/forum/help-1</a></li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>

<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Known issues / Roadmap</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">
<ul>
<li>...</li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>

<section class="oe_container oe_dark">
<div class="oe_row">
<div class="oe_span12">
<h2 class="oe_slogan">Credits</h2>
</div>
<div class="oe_span12">
<h3>Contributors</h3>
<ul>
<li>Firstname Lastname &lt;<a href="mailto:[email protected]">[email protected]</a>&gt;</li>
</ul>
</div>
<div class="oe_span12">
<h3>Maintainer</h3>
<p>
This module is maintained by the OCA.<br/>
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.<br/>
To contribute to this module, please visit <a href="http://odoo-community.org">http://odoo-community.org</a>.<br/>
<a href="http://odoo-community.org"><img class="oe_picture oe_centered" src="http://odoo-community.org/logo.png"></a>
</p>
</div>
</div>
</section>
3 changes: 3 additions & 0 deletions helpdesk_ticket_related/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import test_related_tickets
32 changes: 32 additions & 0 deletions helpdesk_ticket_related/tests/test_related_tickets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<[email protected]>
# 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,
},
)
Loading

0 comments on commit 71fffd4

Please sign in to comment.