diff --git a/helpdesk_mgmt_templates/README.rst b/helpdesk_mgmt_templates/README.rst new file mode 100644 index 0000000000..db3de9101b --- /dev/null +++ b/helpdesk_mgmt_templates/README.rst @@ -0,0 +1,102 @@ +============================= +Helpdesk Management Templates +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d785e09cb190bfcdbafe4d42b6fd30f3bf16f06d6febdb41038241735e093008 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_mgmt_templates + :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_mgmt_templates + :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| + +The module adds the following features: + +- Pre-configure ticket description template based on it's category + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +**To Configure Ticket's Description Template:** + +- Go to Helpdesk -> Configuration -> Categories +- Create a New Category or select an existing record +- In the Template field pre-define the ticket's description that will be triggered based on the category selected + +Usage +===== + +**Go to Helpdesk module:** + +- Select a Team +- Open a Ticket +- Create a new Ticket +- Select Category +- Add a description or modify category description template (if configured) + +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 +~~~~~~~ + +* Cetmix OÜ + +Contributors +~~~~~~~~~~~~ + +* `Cetmix OÜ `_: + + * Ivan Sokolov + * Mikhail Lapin + * Dessan Hemrayev + +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. + +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_mgmt_templates/__init__.py b/helpdesk_mgmt_templates/__init__.py new file mode 100644 index 0000000000..bf8e144111 --- /dev/null +++ b/helpdesk_mgmt_templates/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/helpdesk_mgmt_templates/__manifest__.py b/helpdesk_mgmt_templates/__manifest__.py new file mode 100644 index 0000000000..c0a4cf4ebf --- /dev/null +++ b/helpdesk_mgmt_templates/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Helpdesk Management Templates", + "summary": "Create Helpdesk Ticket Templates", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "Cetmix OÜ, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/helpdesk", + "depends": ["helpdesk_mgmt"], + "data": ["views/helpdesk_ticket_category_views.xml"], + "application": False, +} diff --git a/helpdesk_mgmt_templates/models/__init__.py b/helpdesk_mgmt_templates/models/__init__.py new file mode 100644 index 0000000000..34fbc5efa7 --- /dev/null +++ b/helpdesk_mgmt_templates/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import helpdesk_ticket_category +from . import helpdesk_ticket diff --git a/helpdesk_mgmt_templates/models/helpdesk_ticket.py b/helpdesk_mgmt_templates/models/helpdesk_ticket.py new file mode 100644 index 0000000000..b00bf27821 --- /dev/null +++ b/helpdesk_mgmt_templates/models/helpdesk_ticket.py @@ -0,0 +1,29 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import api, fields, models + + +class HelpdeskTicket(models.Model): + _inherit = "helpdesk.ticket" + + description = fields.Html(store=True, compute="_compute_description") + + @api.depends("category_id") + def _compute_description(self): + for record in self: + if record.category_id.template_description: + record.description = record.category_id.template_description + elif record.description: + record.description = record.description + else: + record.description = "

" + + def copy(self, default=None): + self.ensure_one() + if default is None: + default = {} + if "description" not in default: + default["description"] = "

" + return super().copy(default) diff --git a/helpdesk_mgmt_templates/models/helpdesk_ticket_category.py b/helpdesk_mgmt_templates/models/helpdesk_ticket_category.py new file mode 100644 index 0000000000..726eff4aa5 --- /dev/null +++ b/helpdesk_mgmt_templates/models/helpdesk_ticket_category.py @@ -0,0 +1,10 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class HelpdeskCategory(models.Model): + _inherit = "helpdesk.ticket.category" + + template_description = fields.Html(sanitize_style=True) diff --git a/helpdesk_mgmt_templates/readme/CONFIGURE.rst b/helpdesk_mgmt_templates/readme/CONFIGURE.rst new file mode 100644 index 0000000000..8d424bbd23 --- /dev/null +++ b/helpdesk_mgmt_templates/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +**To Configure Ticket's Description Template:** + +- Go to Helpdesk -> Configuration -> Categories +- Create a New Category or select an existing record +- In the Template field pre-define the ticket's description that will be triggered based on the category selected \ No newline at end of file diff --git a/helpdesk_mgmt_templates/readme/CONTRIBUTORS.rst b/helpdesk_mgmt_templates/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..278ed5b1c1 --- /dev/null +++ b/helpdesk_mgmt_templates/readme/CONTRIBUTORS.rst @@ -0,0 +1,5 @@ +* `Cetmix OÜ `_: + + * Ivan Sokolov + * Mikhail Lapin + * Dessan Hemrayev diff --git a/helpdesk_mgmt_templates/readme/DESCRIPTION.rst b/helpdesk_mgmt_templates/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..9527ae31bb --- /dev/null +++ b/helpdesk_mgmt_templates/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +The module adds the following features: + +- Pre-configure ticket description template based on it's category \ No newline at end of file diff --git a/helpdesk_mgmt_templates/readme/USAGE.rst b/helpdesk_mgmt_templates/readme/USAGE.rst new file mode 100644 index 0000000000..a45c55422b --- /dev/null +++ b/helpdesk_mgmt_templates/readme/USAGE.rst @@ -0,0 +1,7 @@ +**Go to Helpdesk module:** + +- Select a Team +- Open a Ticket +- Create a new Ticket +- Select Category +- Add a description or modify category description template (if configured) diff --git a/helpdesk_mgmt_templates/static/description/icon.png b/helpdesk_mgmt_templates/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/helpdesk_mgmt_templates/static/description/icon.png differ diff --git a/helpdesk_mgmt_templates/static/description/index.html b/helpdesk_mgmt_templates/static/description/index.html new file mode 100644 index 0000000000..da693a7bb8 --- /dev/null +++ b/helpdesk_mgmt_templates/static/description/index.html @@ -0,0 +1,450 @@ + + + + + +Helpdesk Management Templates + + + +
+

Helpdesk Management Templates

+ + +

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

+

The module adds the following features:

+
    +
  • Pre-configure ticket description template based on it’s category
  • +
+

Table of contents

+ +
+

Configuration

+

To Configure Ticket’s Description Template:

+
    +
  • Go to Helpdesk -> Configuration -> Categories
  • +
  • Create a New Category or select an existing record
  • +
  • In the Template field pre-define the ticket’s description that will be triggered based on the category selected
  • +
+
+
+

Usage

+

Go to Helpdesk module:

+
    +
  • Select a Team
  • +
  • Open a Ticket
  • +
  • Create a new Ticket
  • +
  • Select Category
  • +
  • Add a description or modify category description template (if configured)
  • +
+
+
+

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

+
    +
  • Cetmix OÜ
  • +
+
+
+

Contributors

+
    +
  • Cetmix OÜ:
      +
    • Ivan Sokolov
    • +
    • Mikhail Lapin
    • +
    • Dessan Hemrayev
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

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_mgmt_templates/tests/__init__.py b/helpdesk_mgmt_templates/tests/__init__.py new file mode 100644 index 0000000000..c49ed31723 --- /dev/null +++ b/helpdesk_mgmt_templates/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_helpdesk_ticket diff --git a/helpdesk_mgmt_templates/tests/test_helpdesk_ticket.py b/helpdesk_mgmt_templates/tests/test_helpdesk_ticket.py new file mode 100644 index 0000000000..74e72ef7b5 --- /dev/null +++ b/helpdesk_mgmt_templates/tests/test_helpdesk_ticket.py @@ -0,0 +1,61 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import tagged + +from odoo.addons.helpdesk_mgmt.tests.common import TestHelpdeskTicketBase + + +@tagged("post_install", "-at_install") +class TestHelpdeskTicket(TestHelpdeskTicketBase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + helpdesk_ticket_category_obj = cls.env["helpdesk.ticket.category"] + cls.category_1 = helpdesk_ticket_category_obj.create( + {"name": "Category 1", "template_description": "

Description 1

"} + ) + cls.category_2 = helpdesk_ticket_category_obj.create( + {"name": "Category 2", "template_description": "

Description 2

"} + ) + + def test_set_category(self): + """ + Test that setting a category on a ticket correctly sets the category_id and description. + """ + # Check that the category_id is initially empty + self.assertFalse( + self.ticket_a_user_own.category_id, + msg="Initially, the category_id should be empty", + ) + + # Set the category_id to the id of category_1 + self.ticket_a_user_own.category_id = self.category_1.id + + # Check that the category_id has been correctly set + self.assertEqual( + self.ticket_a_user_own.category_id.id, + self.category_1.id, + msg=f"The category ID #{self.category_1.id} was not correctly set", + ) + + # Check that the description has been correctly + # set to the template_description of category_1 + self.assertEqual( + self.ticket_a_user_own.description, + self.category_1.template_description, + msg=( + "The description was not correctly set" + " to the template_description of Category 1" + ), + ) + self.ticket_a_user_own.category_id = False + self.assertEqual( + self.ticket_a_user_own.description, + self.category_1.template_description, + msg=( + "The description was not correctly set" + " to the template_description of Category 1" + ), + ) diff --git a/helpdesk_mgmt_templates/views/helpdesk_ticket_category_views.xml b/helpdesk_mgmt_templates/views/helpdesk_ticket_category_views.xml new file mode 100644 index 0000000000..a7460cd25a --- /dev/null +++ b/helpdesk_mgmt_templates/views/helpdesk_ticket_category_views.xml @@ -0,0 +1,23 @@ + + + + view.helpdesk_category.tree + helpdesk.ticket.category + + + + + + + + + view.helpdesk_category.form + helpdesk.ticket.category + + + + + + + + diff --git a/setup/helpdesk_mgmt_templates/odoo/addons/helpdesk_mgmt_templates b/setup/helpdesk_mgmt_templates/odoo/addons/helpdesk_mgmt_templates new file mode 120000 index 0000000000..e228f15b91 --- /dev/null +++ b/setup/helpdesk_mgmt_templates/odoo/addons/helpdesk_mgmt_templates @@ -0,0 +1 @@ +../../../../helpdesk_mgmt_templates \ No newline at end of file diff --git a/setup/helpdesk_mgmt_templates/setup.py b/setup/helpdesk_mgmt_templates/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/helpdesk_mgmt_templates/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)