Skip to content

Commit b45a636

Browse files
committed
Merge PR #684 into 17.0
Signed-off-by pedrobaeza
2 parents 6e51432 + 8e2d92a commit b45a636

31 files changed

+1806
-61
lines changed

Diff for: helpdesk_mgmt/tests/common.py

+13-19
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,30 @@
11
# Copyright 2023 Tecnativa - Víctor Martínez
22
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
3-
from odoo.tests import common, new_test_user
3+
from odoo.tests import new_test_user
44

5+
from odoo.addons.base.tests.common import BaseCommon
56

6-
class TestHelpdeskTicketBase(common.TransactionCase):
7+
8+
class TestHelpdeskTicketBase(BaseCommon):
79
@classmethod
810
def setUpClass(cls):
911
super().setUpClass()
1012
helpdesk_ticket_team = cls.env["helpdesk.ticket.team"]
11-
ctx = {
12-
"mail_create_nolog": True,
13-
"mail_create_nosubscribe": True,
14-
"mail_notrack": True,
15-
"no_reset_password": True,
16-
}
1713
cls.company = cls.env.company
1814
cls.user_own = new_test_user(
1915
cls.env,
2016
login="helpdesk_mgmt-user_own",
2117
groups="helpdesk_mgmt.group_helpdesk_user_own",
22-
context=ctx,
2318
)
2419
cls.user_team = new_test_user(
2520
cls.env,
2621
login="helpdesk_mgmt-user_team",
2722
groups="helpdesk_mgmt.group_helpdesk_user_team",
28-
context=ctx,
2923
)
3024
cls.user = new_test_user(
3125
cls.env,
3226
login="helpdesk_mgmt-user",
3327
groups="helpdesk_mgmt.group_helpdesk_user",
34-
context=ctx,
3528
)
3629
cls.stage_closed = cls.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_done")
3730
cls.team_a = helpdesk_ticket_team.create(
@@ -41,16 +34,17 @@ def setUpClass(cls):
4134
{"name": "Team B", "user_ids": [(6, 0, [cls.user_team.id])]}
4235
)
4336
cls.new_stage = cls.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_new")
44-
cls.ticket_a_unassigned = cls._create_ticket(cls, cls.team_a)
37+
cls.ticket_a_unassigned = cls._create_ticket(cls.team_a)
4538
cls.ticket_a_unassigned.priority = "3"
46-
cls.ticket_a_user_own = cls._create_ticket(cls, cls.team_a, cls.user_own)
47-
cls.ticket_a_user_team = cls._create_ticket(cls, cls.team_a, cls.user_team)
48-
cls.ticket_b_unassigned = cls._create_ticket(cls, cls.team_b)
49-
cls.ticket_b_user_own = cls._create_ticket(cls, cls.team_b, cls.user_own)
50-
cls.ticket_b_user_team = cls._create_ticket(cls, cls.team_b, cls.user_team)
39+
cls.ticket_a_user_own = cls._create_ticket(cls.team_a, cls.user_own)
40+
cls.ticket_a_user_team = cls._create_ticket(cls.team_a, cls.user_team)
41+
cls.ticket_b_unassigned = cls._create_ticket(cls.team_b)
42+
cls.ticket_b_user_own = cls._create_ticket(cls.team_b, cls.user_own)
43+
cls.ticket_b_user_team = cls._create_ticket(cls.team_b, cls.user_team)
5144

52-
def _create_ticket(self, team, user=False):
53-
ticket = self.env["helpdesk.ticket"].create(
45+
@classmethod
46+
def _create_ticket(cls, team, user=False):
47+
ticket = cls.env["helpdesk.ticket"].create(
5448
{
5549
"name": "Ticket {} ({})".format(
5650
team.name, user.login if user else "unassigned"

Diff for: helpdesk_mgmt/tests/test_helpdesk_portal.py

+16-19
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from odoo import http
55
from odoo.tests.common import new_test_user, tagged
66

7-
from odoo.addons.base.tests.common import HttpCaseWithUserPortal
7+
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT, HttpCaseWithUserPortal
88

99

1010
@tagged("post_install", "-at_install")
@@ -14,33 +14,30 @@ class TestHelpdeskPortalBase(HttpCaseWithUserPortal):
1414
HTML produced by our routes.
1515
"""
1616

17-
def setUp(self):
18-
super().setUp()
19-
ctx = {
20-
"mail_create_nolog": True,
21-
"mail_create_nosubscribe": True,
22-
"mail_notrack": True,
23-
"no_reset_password": True,
24-
}
25-
self.new_ticket_title = "portal-new-submitted-ticket-subject"
26-
self.new_ticket_desc_lines = ( # multiline description to check line breaks
17+
@classmethod
18+
def setUpClass(cls):
19+
super().setUpClass()
20+
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
21+
cls.new_ticket_title = "portal-new-submitted-ticket-subject"
22+
cls.new_ticket_desc_lines = ( # multiline description to check line breaks
2723
"portal-new-submitted-ticket-description-line-1",
2824
"portal-new-submitted-ticket-description-line-2",
2925
)
30-
self.company = self.env.ref("base.main_company")
31-
self.partner_portal.parent_id = self.company.partner_id
26+
cls.company = cls.env.ref("base.main_company")
27+
cls.partner_portal.parent_id = cls.company.partner_id
3228
# Create a basic user with no helpdesk permissions.
33-
self.basic_user = new_test_user(self.env, login="test-basic-user", context=ctx)
34-
self.basic_user.parent_id = self.company.partner_id
29+
cls.basic_user = new_test_user(cls.env, login="test-basic-user")
30+
cls.basic_user.parent_id = cls.company.partner_id
3531
# Create a ticket submitted by our portal user.
36-
self.portal_ticket = self._create_ticket(
37-
self.partner_portal, "portal-ticket-title"
32+
cls.portal_ticket = cls._create_ticket(
33+
cls.partner_portal, "portal-ticket-title"
3834
)
3935

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

43-
def _create_ticket(self, partner, ticket_title, **values):
39+
@classmethod
40+
def _create_ticket(cls, partner, ticket_title, **values):
4441
"""Create a ticket submitted by the specified partner."""
4542
data = {
4643
"name": ticket_title,
@@ -50,7 +47,7 @@ def _create_ticket(self, partner, ticket_title, **values):
5047
"partner_name": partner.name,
5148
}
5249
data.update(**values)
53-
return self.env["helpdesk.ticket"].create(data)
50+
return cls.env["helpdesk.ticket"].create(data)
5451

5552
def _submit_ticket(self, **values):
5653
data = {

Diff for: helpdesk_mgmt/tests/test_res_partner.py

+24-23
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
1-
from odoo.tests.common import TransactionCase
1+
from odoo.addons.base.tests.common import BaseCommon
22

33

4-
class TestPartner(TransactionCase):
5-
def setUp(self):
6-
super().setUp()
7-
self.partner_obj = self.env["res.partner"]
8-
self.ticket_obj = self.env["helpdesk.ticket"]
9-
self.stage_id_closed = self.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_done")
10-
self.parent_id = self.partner_obj.create({"name": "Parent 1"})
11-
self.child_id_1 = self.partner_obj.create({"name": "Child 1"})
12-
self.child_id_2 = self.partner_obj.create({"name": "Child 2"})
13-
self.child_id_3 = self.partner_obj.create({"name": "Child 3"})
14-
self.tickets = []
15-
self.parent_id.child_ids = [
16-
(4, self.child_id_1.id),
17-
(4, self.child_id_2.id),
18-
(4, self.child_id_3.id),
4+
class TestPartner(BaseCommon):
5+
@classmethod
6+
def setUpClass(cls):
7+
super().setUpClass()
8+
cls.partner_obj = cls.env["res.partner"]
9+
cls.ticket_obj = cls.env["helpdesk.ticket"]
10+
cls.stage_id_closed = cls.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_done")
11+
cls.parent_id = cls.partner_obj.create({"name": "Parent 1"})
12+
cls.child_id_1 = cls.partner_obj.create({"name": "Child 1"})
13+
cls.child_id_2 = cls.partner_obj.create({"name": "Child 2"})
14+
cls.child_id_3 = cls.partner_obj.create({"name": "Child 3"})
15+
cls.tickets = []
16+
cls.parent_id.child_ids = [
17+
(4, cls.child_id_1.id),
18+
(4, cls.child_id_2.id),
19+
(4, cls.child_id_3.id),
1920
]
2021
for i in [69, 155, 314, 420]:
21-
self.tickets.append(
22-
self.ticket_obj.create(
22+
cls.tickets.append(
23+
cls.ticket_obj.create(
2324
{
2425
"name": f"Nice ticket {i}",
2526
"description": f"Nice ticket {i} description",
2627
}
2728
)
2829
)
29-
self.parent_id.helpdesk_ticket_ids = [(4, self.tickets[0].id)]
30-
self.child_id_1.helpdesk_ticket_ids = [(4, self.tickets[1].id)]
31-
self.child_id_2.helpdesk_ticket_ids = [(4, self.tickets[2].id)]
32-
self.child_id_3.helpdesk_ticket_ids = [(4, self.tickets[3].id)]
33-
self.child_id_3.helpdesk_ticket_ids[-1].stage_id = self.stage_id_closed
30+
cls.parent_id.helpdesk_ticket_ids = [(4, cls.tickets[0].id)]
31+
cls.child_id_1.helpdesk_ticket_ids = [(4, cls.tickets[1].id)]
32+
cls.child_id_2.helpdesk_ticket_ids = [(4, cls.tickets[2].id)]
33+
cls.child_id_3.helpdesk_ticket_ids = [(4, cls.tickets[3].id)]
34+
cls.child_id_3.helpdesk_ticket_ids[-1].stage_id = cls.stage_id_closed
3435

3536
def test_ticket_count(self):
3637
self.assertEqual(self.parent_id.helpdesk_ticket_count, 4)

Diff for: helpdesk_mgmt_project/README.rst

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
================
2+
Helpdesk Project
3+
================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:ff13c3cd597a5fac1ba2aa9d3c495d175e52fdc65bc94f5381f1e12756e418bb
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Production/Stable
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhelpdesk-lightgray.png?logo=github
20+
:target: https://github.com/OCA/helpdesk/tree/17.0/helpdesk_mgmt_project
21+
:alt: OCA/helpdesk
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/helpdesk-17-0/helpdesk-17-0-helpdesk_mgmt_project
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/helpdesk&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module adds Project in Helpdesk. We add to the project form view a
32+
ticket counter that redirects you to the helpdesk
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Bug Tracker
40+
===========
41+
42+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/helpdesk/issues>`_.
43+
In case of trouble, please check there if your issue has already been reported.
44+
If you spotted it first, help us to smash it by providing a detailed and welcomed
45+
`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**>`_.
46+
47+
Do not contact contributors directly about support or help with technical issues.
48+
49+
Credits
50+
=======
51+
52+
Authors
53+
-------
54+
55+
* PuntSistemes S.L.U.
56+
57+
Contributors
58+
------------
59+
60+
- `Puntsistemes <https://www.puntsistemes.es>`__:
61+
62+
- Carlos Ramos Hernández
63+
64+
- `Tecnativa <https://www.tecnativa.com>`__:
65+
66+
- Pedro M. Baeza
67+
68+
- `CommitSun <https://www.commitsun.com>`__:
69+
70+
- Darío Lodeiros
71+
72+
- `Solvos <https://www.solvos.es>`__:
73+
74+
- David Alonso
75+
76+
- `Sygel <https://www.sygel.es>`__:
77+
78+
- Manuel Regidor
79+
80+
- `ALBA Software <https://www.albasoft.com>`__:
81+
82+
- Rafa Morant
83+
84+
Maintainers
85+
-----------
86+
87+
This module is maintained by the OCA.
88+
89+
.. image:: https://odoo-community.org/logo.png
90+
:alt: Odoo Community Association
91+
:target: https://odoo-community.org
92+
93+
OCA, or the Odoo Community Association, is a nonprofit organization whose
94+
mission is to support the collaborative development of Odoo features and
95+
promote its widespread use.
96+
97+
This module is part of the `OCA/helpdesk <https://github.com/OCA/helpdesk/tree/17.0/helpdesk_mgmt_project>`_ project on GitHub.
98+
99+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Diff for: helpdesk_mgmt_project/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

Diff for: helpdesk_mgmt_project/__manifest__.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
2+
3+
{
4+
"name": "Helpdesk Project",
5+
"summary": "Add the option to select project in the tickets.",
6+
"version": "17.0.1.0.0",
7+
"license": "AGPL-3",
8+
"category": "After-Sales",
9+
"author": "PuntSistemes S.L.U., " "Odoo Community Association (OCA)",
10+
"website": "https://github.com/OCA/helpdesk",
11+
"depends": ["helpdesk_mgmt", "project"],
12+
"data": [
13+
"views/helpdesk_ticket_view.xml",
14+
"views/helpdesk_ticket_team_view.xml",
15+
"views/project_view.xml",
16+
"views/project_task_view.xml",
17+
],
18+
"development_status": "Production/Stable",
19+
"auto_install": True,
20+
}

0 commit comments

Comments
 (0)