Skip to content

Commit

Permalink
Merge PR #684 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jan 16, 2025
2 parents 6e51432 + 8e2d92a commit b45a636
Show file tree
Hide file tree
Showing 31 changed files with 1,806 additions and 61 deletions.
32 changes: 13 additions & 19 deletions helpdesk_mgmt/tests/common.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
# Copyright 2023 Tecnativa - Víctor Martínez
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo.tests import common, new_test_user
from odoo.tests import new_test_user

from odoo.addons.base.tests.common import BaseCommon

class TestHelpdeskTicketBase(common.TransactionCase):

class TestHelpdeskTicketBase(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
helpdesk_ticket_team = cls.env["helpdesk.ticket.team"]
ctx = {
"mail_create_nolog": True,
"mail_create_nosubscribe": True,
"mail_notrack": True,
"no_reset_password": True,
}
cls.company = cls.env.company
cls.user_own = new_test_user(
cls.env,
login="helpdesk_mgmt-user_own",
groups="helpdesk_mgmt.group_helpdesk_user_own",
context=ctx,
)
cls.user_team = new_test_user(
cls.env,
login="helpdesk_mgmt-user_team",
groups="helpdesk_mgmt.group_helpdesk_user_team",
context=ctx,
)
cls.user = new_test_user(
cls.env,
login="helpdesk_mgmt-user",
groups="helpdesk_mgmt.group_helpdesk_user",
context=ctx,
)
cls.stage_closed = cls.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_done")
cls.team_a = helpdesk_ticket_team.create(
Expand All @@ -41,16 +34,17 @@ def setUpClass(cls):
{"name": "Team B", "user_ids": [(6, 0, [cls.user_team.id])]}
)
cls.new_stage = cls.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_new")
cls.ticket_a_unassigned = cls._create_ticket(cls, cls.team_a)
cls.ticket_a_unassigned = cls._create_ticket(cls.team_a)
cls.ticket_a_unassigned.priority = "3"
cls.ticket_a_user_own = cls._create_ticket(cls, cls.team_a, cls.user_own)
cls.ticket_a_user_team = cls._create_ticket(cls, cls.team_a, cls.user_team)
cls.ticket_b_unassigned = cls._create_ticket(cls, cls.team_b)
cls.ticket_b_user_own = cls._create_ticket(cls, cls.team_b, cls.user_own)
cls.ticket_b_user_team = cls._create_ticket(cls, cls.team_b, cls.user_team)
cls.ticket_a_user_own = cls._create_ticket(cls.team_a, cls.user_own)
cls.ticket_a_user_team = cls._create_ticket(cls.team_a, cls.user_team)
cls.ticket_b_unassigned = cls._create_ticket(cls.team_b)
cls.ticket_b_user_own = cls._create_ticket(cls.team_b, cls.user_own)
cls.ticket_b_user_team = cls._create_ticket(cls.team_b, cls.user_team)

def _create_ticket(self, team, user=False):
ticket = self.env["helpdesk.ticket"].create(
@classmethod
def _create_ticket(cls, team, user=False):
ticket = cls.env["helpdesk.ticket"].create(
{
"name": "Ticket {} ({})".format(
team.name, user.login if user else "unassigned"
Expand Down
35 changes: 16 additions & 19 deletions helpdesk_mgmt/tests/test_helpdesk_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from odoo import http
from odoo.tests.common import new_test_user, tagged

from odoo.addons.base.tests.common import HttpCaseWithUserPortal
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT, HttpCaseWithUserPortal


@tagged("post_install", "-at_install")
Expand All @@ -14,33 +14,30 @@ class TestHelpdeskPortalBase(HttpCaseWithUserPortal):
HTML produced by our routes.
"""

def setUp(self):
super().setUp()
ctx = {
"mail_create_nolog": True,
"mail_create_nosubscribe": True,
"mail_notrack": True,
"no_reset_password": True,
}
self.new_ticket_title = "portal-new-submitted-ticket-subject"
self.new_ticket_desc_lines = ( # multiline description to check line breaks
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.new_ticket_title = "portal-new-submitted-ticket-subject"
cls.new_ticket_desc_lines = ( # multiline description to check line breaks
"portal-new-submitted-ticket-description-line-1",
"portal-new-submitted-ticket-description-line-2",
)
self.company = self.env.ref("base.main_company")
self.partner_portal.parent_id = self.company.partner_id
cls.company = cls.env.ref("base.main_company")
cls.partner_portal.parent_id = cls.company.partner_id
# Create a basic user with no helpdesk permissions.
self.basic_user = new_test_user(self.env, login="test-basic-user", context=ctx)
self.basic_user.parent_id = self.company.partner_id
cls.basic_user = new_test_user(cls.env, login="test-basic-user")
cls.basic_user.parent_id = cls.company.partner_id
# Create a ticket submitted by our portal user.
self.portal_ticket = self._create_ticket(
self.partner_portal, "portal-ticket-title"
cls.portal_ticket = cls._create_ticket(
cls.partner_portal, "portal-ticket-title"
)

def get_new_tickets(self, user):
return self.env["helpdesk.ticket"].with_user(user).search([])

def _create_ticket(self, partner, ticket_title, **values):
@classmethod
def _create_ticket(cls, partner, ticket_title, **values):
"""Create a ticket submitted by the specified partner."""
data = {
"name": ticket_title,
Expand All @@ -50,7 +47,7 @@ def _create_ticket(self, partner, ticket_title, **values):
"partner_name": partner.name,
}
data.update(**values)
return self.env["helpdesk.ticket"].create(data)
return cls.env["helpdesk.ticket"].create(data)

def _submit_ticket(self, **values):
data = {
Expand Down
47 changes: 24 additions & 23 deletions helpdesk_mgmt/tests/test_res_partner.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
from odoo.tests.common import TransactionCase
from odoo.addons.base.tests.common import BaseCommon


class TestPartner(TransactionCase):
def setUp(self):
super().setUp()
self.partner_obj = self.env["res.partner"]
self.ticket_obj = self.env["helpdesk.ticket"]
self.stage_id_closed = self.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_done")
self.parent_id = self.partner_obj.create({"name": "Parent 1"})
self.child_id_1 = self.partner_obj.create({"name": "Child 1"})
self.child_id_2 = self.partner_obj.create({"name": "Child 2"})
self.child_id_3 = self.partner_obj.create({"name": "Child 3"})
self.tickets = []
self.parent_id.child_ids = [
(4, self.child_id_1.id),
(4, self.child_id_2.id),
(4, self.child_id_3.id),
class TestPartner(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.partner_obj = cls.env["res.partner"]
cls.ticket_obj = cls.env["helpdesk.ticket"]
cls.stage_id_closed = cls.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_done")
cls.parent_id = cls.partner_obj.create({"name": "Parent 1"})
cls.child_id_1 = cls.partner_obj.create({"name": "Child 1"})
cls.child_id_2 = cls.partner_obj.create({"name": "Child 2"})
cls.child_id_3 = cls.partner_obj.create({"name": "Child 3"})
cls.tickets = []
cls.parent_id.child_ids = [
(4, cls.child_id_1.id),
(4, cls.child_id_2.id),
(4, cls.child_id_3.id),
]
for i in [69, 155, 314, 420]:
self.tickets.append(
self.ticket_obj.create(
cls.tickets.append(
cls.ticket_obj.create(
{
"name": f"Nice ticket {i}",
"description": f"Nice ticket {i} description",
}
)
)
self.parent_id.helpdesk_ticket_ids = [(4, self.tickets[0].id)]
self.child_id_1.helpdesk_ticket_ids = [(4, self.tickets[1].id)]
self.child_id_2.helpdesk_ticket_ids = [(4, self.tickets[2].id)]
self.child_id_3.helpdesk_ticket_ids = [(4, self.tickets[3].id)]
self.child_id_3.helpdesk_ticket_ids[-1].stage_id = self.stage_id_closed
cls.parent_id.helpdesk_ticket_ids = [(4, cls.tickets[0].id)]
cls.child_id_1.helpdesk_ticket_ids = [(4, cls.tickets[1].id)]
cls.child_id_2.helpdesk_ticket_ids = [(4, cls.tickets[2].id)]
cls.child_id_3.helpdesk_ticket_ids = [(4, cls.tickets[3].id)]
cls.child_id_3.helpdesk_ticket_ids[-1].stage_id = cls.stage_id_closed

def test_ticket_count(self):
self.assertEqual(self.parent_id.helpdesk_ticket_count, 4)
Expand Down
99 changes: 99 additions & 0 deletions helpdesk_mgmt_project/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
================
Helpdesk Project
================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ff13c3cd597a5fac1ba2aa9d3c495d175e52fdc65bc94f5381f1e12756e418bb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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/17.0/helpdesk_mgmt_project
:alt: OCA/helpdesk
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/helpdesk-17-0/helpdesk-17-0-helpdesk_mgmt_project
: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=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds Project in Helpdesk. We add to the project form view a
ticket counter that redirects you to the helpdesk

**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_mgmt_project%0Aversion:%2017.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
-------

* PuntSistemes S.L.U.

Contributors
------------

- `Puntsistemes <https://www.puntsistemes.es>`__:

- Carlos Ramos Hernández

- `Tecnativa <https://www.tecnativa.com>`__:

- Pedro M. Baeza

- `CommitSun <https://www.commitsun.com>`__:

- Darío Lodeiros

- `Solvos <https://www.solvos.es>`__:

- David Alonso

- `Sygel <https://www.sygel.es>`__:

- Manuel Regidor

- `ALBA Software <https://www.albasoft.com>`__:

- Rafa Morant

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 <https://github.com/OCA/helpdesk/tree/17.0/helpdesk_mgmt_project>`_ project on GitHub.

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

{
"name": "Helpdesk Project",
"summary": "Add the option to select project in the tickets.",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"category": "After-Sales",
"author": "PuntSistemes S.L.U., " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/helpdesk",
"depends": ["helpdesk_mgmt", "project"],
"data": [
"views/helpdesk_ticket_view.xml",
"views/helpdesk_ticket_team_view.xml",
"views/project_view.xml",
"views/project_task_view.xml",
],
"development_status": "Production/Stable",
"auto_install": True,
}
Loading

0 comments on commit b45a636

Please sign in to comment.