Skip to content

Commit 402990a

Browse files
committed
[18.0][MIG] crm_team_parent
1 parent 0cd8c48 commit 402990a

File tree

13 files changed

+56
-78
lines changed

13 files changed

+56
-78
lines changed

crm_team_parent/README.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@ Crm Team Parent
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github
20-
:target: https://github.com/OCA/crm/tree/12.0/crm_team_parent
20+
:target: https://github.com/OCA/crm/tree/18.0/crm_team_parent
2121
:alt: OCA/crm
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/crm-12-0/crm-12-0-crm_team_parent
23+
:target: https://translation.odoo-community.org/projects/crm-18-0/crm-18-0-crm_team_parent
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=12.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

31-
This module adds a 'Parent Team' field on the Sales Team form. This field is also displayed in the Sales Teams list.
32-
Plus, a constraint check is performed in order to avoid loops in the hierarchy.
31+
This module adds a 'Parent Team' field on the Sales Team form. This
32+
field is also displayed in the Sales Teams list. Plus, a constraint
33+
check is performed in order to avoid loops in the hierarchy.
3334

3435
**Table of contents**
3536

@@ -41,35 +42,35 @@ Usage
4142

4243
To use this module, you need to:
4344

44-
#. Go to *CRM > Configuration > Sales Teams*.
45-
#. Create/edit a sales team.
46-
#. The parent team will be checked for loop in the hierarchy.
45+
1. Go to *CRM > Configuration > Sales Teams*.
46+
2. Create/edit a sales team.
47+
3. The parent team will be checked for loop in the hierarchy.
4748

4849
Bug Tracker
4950
===========
5051

5152
Bugs are tracked on `GitHub Issues <https://github.com/OCA/crm/issues>`_.
5253
In case of trouble, please check there if your issue has already been reported.
5354
If you spotted it first, help us to smash it by providing a detailed and welcomed
54-
`feedback <https://github.com/OCA/crm/issues/new?body=module:%20crm_team_parent%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
55+
`feedback <https://github.com/OCA/crm/issues/new?body=module:%20crm_team_parent%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
5556

5657
Do not contact contributors directly about support or help with technical issues.
5758

5859
Credits
5960
=======
6061

6162
Authors
62-
~~~~~~~
63+
-------
6364

6465
* ACSONE SA/NV
6566

6667
Contributors
67-
~~~~~~~~~~~~
68+
------------
6869

69-
* Quentin Groulard <[email protected]>
70+
- Quentin Groulard <[email protected]>
7071

7172
Maintainers
72-
~~~~~~~~~~~
73+
-----------
7374

7475
This module is maintained by the OCA.
7576

@@ -81,6 +82,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
8182
mission is to support the collaborative development of Odoo features and
8283
promote its widespread use.
8384

84-
This module is part of the `OCA/crm <https://github.com/OCA/crm/tree/12.0/crm_team_parent>`_ project on GitHub.
85+
This module is part of the `OCA/crm <https://github.com/OCA/crm/tree/18.0/crm_team_parent>`_ project on GitHub.
8586

8687
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

crm_team_parent/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Crm Team Parent",
66
"summary": """
77
Add a parent field on sales teams.""",
8-
"version": "12.0.1.0.1",
8+
"version": "18.0.1.0.0",
99
"license": "AGPL-3",
1010
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/crm",

crm_team_parent/models/crm_team.py

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
# Copyright 2018 ACSONE SA/NV
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33

4-
from odoo import api, fields, models, _
5-
from odoo.exceptions import ValidationError
6-
7-
8-
class ParentLoopError(ValidationError):
9-
pass
4+
from odoo import fields, models
105

116

127
class CrmTeam(models.Model):
13-
148
_inherit = "crm.team"
159
_parent_store = True
1610
parent_path = fields.Char(index=True)
@@ -20,21 +14,3 @@ class CrmTeam(models.Model):
2014
inverse_name="parent_id",
2115
string="Children team",
2216
)
23-
24-
@api.constrains("parent_id")
25-
def _constrains_parent_id(self):
26-
def _check_for_loop(new_child, current):
27-
if not current.parent_id:
28-
return True
29-
if current.parent_id == new_child:
30-
return False
31-
return _check_for_loop(new_child, current.parent_id)
32-
33-
for rec in self.filtered("parent_id"):
34-
if not _check_for_loop(rec, rec):
35-
raise ParentLoopError(
36-
_(
37-
"Wrong Parent Team: "
38-
"No loop allowed in the teams' hierarchy."
39-
)
40-
)

crm_team_parent/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Quentin Groulard \<<[email protected]>\>

crm_team_parent/readme/CONTRIBUTORS.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

crm_team_parent/readme/DESCRIPTION.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This module adds a 'Parent Team' field on the Sales Team form. This
2+
field is also displayed in the Sales Teams list. Plus, a constraint
3+
check is performed in order to avoid loops in the hierarchy.

crm_team_parent/readme/DESCRIPTION.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.

crm_team_parent/readme/USAGE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
To use this module, you need to:
2+
3+
1. Go to *CRM \> Configuration \> Sales Teams*.
4+
2. Create/edit a sales team.
5+
3. The parent team will be checked for loop in the hierarchy.

crm_team_parent/readme/USAGE.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)