odoo-addon-analytic-hr-department-restriction 16.0.1.0.1.1__py3-none-any.whl → 18.0.1.0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. odoo/addons/analytic_hr_department_restriction/README.rst +29 -20
  2. odoo/addons/analytic_hr_department_restriction/__manifest__.py +1 -1
  3. odoo/addons/analytic_hr_department_restriction/i18n/analytic_hr_department_restriction.pot +1 -1
  4. odoo/addons/analytic_hr_department_restriction/i18n/it.po +7 -9
  5. odoo/addons/analytic_hr_department_restriction/migrations/18.0.1.0.0/post-migration.py +16 -0
  6. odoo/addons/analytic_hr_department_restriction/migrations/18.0.1.0.0/pre-migration.py +17 -0
  7. odoo/addons/analytic_hr_department_restriction/models/account_analytic_plan.py +15 -1
  8. odoo/addons/analytic_hr_department_restriction/models/ir_rule.py +1 -1
  9. odoo/addons/analytic_hr_department_restriction/readme/{CONFIGURE.rst → CONFIGURE.md} +1 -1
  10. odoo/addons/analytic_hr_department_restriction/readme/CONTRIBUTORS.md +3 -0
  11. odoo/addons/analytic_hr_department_restriction/readme/DESCRIPTION.md +8 -0
  12. odoo/addons/analytic_hr_department_restriction/readme/USAGE.md +11 -0
  13. odoo/addons/analytic_hr_department_restriction/static/description/index.html +20 -11
  14. odoo/addons/analytic_hr_department_restriction/tests/test_analytic_hr_department_restriction.py +18 -11
  15. odoo/addons/analytic_hr_department_restriction/views/account_analytic_plan_views.xml +3 -8
  16. {odoo_addon_analytic_hr_department_restriction-16.0.1.0.1.1.dist-info → odoo_addon_analytic_hr_department_restriction-18.0.1.0.0.3.dist-info}/METADATA +34 -25
  17. {odoo_addon_analytic_hr_department_restriction-16.0.1.0.1.1.dist-info → odoo_addon_analytic_hr_department_restriction-18.0.1.0.0.3.dist-info}/RECORD +19 -17
  18. {odoo_addon_analytic_hr_department_restriction-16.0.1.0.1.1.dist-info → odoo_addon_analytic_hr_department_restriction-18.0.1.0.0.3.dist-info}/WHEEL +1 -1
  19. odoo_addon_analytic_hr_department_restriction-18.0.1.0.0.3.dist-info/top_level.txt +1 -0
  20. odoo/addons/analytic_hr_department_restriction/readme/CONTRIBUTORS.rst +0 -4
  21. odoo/addons/analytic_hr_department_restriction/readme/DESCRIPTION.rst +0 -5
  22. odoo/addons/analytic_hr_department_restriction/readme/USAGE.rst +0 -5
  23. odoo_addon_analytic_hr_department_restriction-16.0.1.0.1.1.dist-info/top_level.txt +0 -1
@@ -7,7 +7,7 @@ Analytic distributions restriction per HR department
7
7
  !! This file is generated by oca-gen-addon-readme !!
8
8
  !! changes will be overwritten. !!
9
9
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:bb538fc6b059dbce7461cad0af90c29efadbb98b14482a9535a25d4db428127c
10
+ !! source digest: sha256:2f165ed1c2775074c2ea2df1c27ee4a6504ccb60f87efe765360770481b69158
11
11
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
 
13
13
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -17,22 +17,25 @@ Analytic distributions restriction per HR department
17
17
  :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18
18
  :alt: License: AGPL-3
19
19
  .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--analytic-lightgray.png?logo=github
20
- :target: https://github.com/OCA/account-analytic/tree/16.0/analytic_hr_department_restriction
20
+ :target: https://github.com/OCA/account-analytic/tree/18.0/analytic_hr_department_restriction
21
21
  :alt: OCA/account-analytic
22
22
  .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23
- :target: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-analytic_hr_department_restriction
23
+ :target: https://translation.odoo-community.org/projects/account-analytic-18-0/account-analytic-18-0-analytic_hr_department_restriction
24
24
  :alt: Translate me on Weblate
25
25
  .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26
- :target: https://runboat.odoo-community.org/builds?repo=OCA/account-analytic&target_branch=16.0
26
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/account-analytic&target_branch=18.0
27
27
  :alt: Try me on Runboat
28
28
 
29
29
  |badge1| |badge2| |badge3| |badge4| |badge5|
30
30
 
31
- This module allows you to limit plans and analytical accounts by employee departments.
31
+ This module allows you to limit plans and analytical accounts by
32
+ employee departments.
32
33
 
33
- Users will only be able to view plans and analytical accounts linked to their employee's department or those with no department defined.
34
+ Users will only be able to view plans and analytical accounts linked to
35
+ their employee's department or those with no department defined.
34
36
 
35
- Users with the "Invoicing / Billing" permission will be able to view all plans and analytical accounts without restrictions.
37
+ Users with the "Invoicing / Invoicing" permission will be able to view
38
+ all plans and analytical accounts without restrictions.
36
39
 
37
40
  **Table of contents**
38
41
 
@@ -48,11 +51,17 @@ Configuration
48
51
  Usage
49
52
  =====
50
53
 
51
- #. Go to an analytical plan/account and define your employee's department.
52
- #. Go to an analytical plan/account and define a different department than your employee's department.
53
- #. Go to an analytical plan/account and leave the department empty.
54
- #. Users without the "Invoicing / Billing" permission will be able to see only the plans/analytical accounts of the user's employee's department.
55
- #. Users with the "Analytic Accounting (without department)" will be able to view the plans/analytical accounts without a department, as will users with the permission "Invoicing / Billing".
54
+ 1. Go to an analytical plan/account and define your employee's
55
+ department.
56
+ 2. Go to an analytical plan/account and define a different department
57
+ than your employee's department.
58
+ 3. Go to an analytical plan/account and leave the department empty.
59
+ 4. Users without the "Invoicing / Invoicing" permission will be able to
60
+ see only the plans/analytical accounts of the user's employee's
61
+ department.
62
+ 5. Users with the "Analytic Accounting (without department)" will be
63
+ able to view the plans/analytical accounts without a department, as
64
+ will users with the permission "Invoicing / Invoicing".
56
65
 
57
66
  Bug Tracker
58
67
  ===========
@@ -60,7 +69,7 @@ Bug Tracker
60
69
  Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-analytic/issues>`_.
61
70
  In case of trouble, please check there if your issue has already been reported.
62
71
  If you spotted it first, help us to smash it by providing a detailed and welcomed
63
- `feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20analytic_hr_department_restriction%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
72
+ `feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20analytic_hr_department_restriction%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
64
73
 
65
74
  Do not contact contributors directly about support or help with technical issues.
66
75
 
@@ -68,20 +77,20 @@ Credits
68
77
  =======
69
78
 
70
79
  Authors
71
- ~~~~~~~
80
+ -------
72
81
 
73
82
  * Tecnativa
74
83
 
75
84
  Contributors
76
- ~~~~~~~~~~~~
85
+ ------------
77
86
 
78
- * `Tecnativa <https://www.tecnativa.com>`__:
87
+ - `Tecnativa <https://www.tecnativa.com>`__:
79
88
 
80
- * Víctor Martínez
81
- * Pedro M. Baeza
89
+ - Víctor Martínez
90
+ - Pedro M. Baeza
82
91
 
83
92
  Maintainers
84
- ~~~~~~~~~~~
93
+ -----------
85
94
 
86
95
  This module is maintained by the OCA.
87
96
 
@@ -101,6 +110,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
101
110
 
102
111
  |maintainer-victoralmau|
103
112
 
104
- This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/16.0/analytic_hr_department_restriction>`_ project on GitHub.
113
+ This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/18.0/analytic_hr_department_restriction>`_ project on GitHub.
105
114
 
106
115
  You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
@@ -4,7 +4,7 @@
4
4
  "name": "Analytic distributions restriction per HR department",
5
5
  "author": "Tecnativa, Odoo Community Association (OCA)",
6
6
  "website": "https://github.com/OCA/account-analytic",
7
- "version": "16.0.1.0.1",
7
+ "version": "18.0.1.0.0",
8
8
  "depends": ["account", "hr"],
9
9
  "license": "AGPL-3",
10
10
  "category": "Account",
@@ -4,7 +4,7 @@
4
4
  #
5
5
  msgid ""
6
6
  msgstr ""
7
- "Project-Id-Version: Odoo Server 16.0\n"
7
+ "Project-Id-Version: Odoo Server 18.0\n"
8
8
  "Report-Msgid-Bugs-To: \n"
9
9
  "Last-Translator: \n"
10
10
  "Language-Team: \n"
@@ -4,41 +4,39 @@
4
4
  #
5
5
  msgid ""
6
6
  msgstr ""
7
- "Project-Id-Version: Odoo Server 16.0\n"
7
+ "Project-Id-Version: Odoo Server 18.0\n"
8
8
  "Report-Msgid-Bugs-To: \n"
9
- "PO-Revision-Date: 2025-05-10 10:24+0000\n"
10
- "Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
9
+ "Last-Translator: Automatically generated\n"
11
10
  "Language-Team: none\n"
12
11
  "Language: it\n"
13
12
  "MIME-Version: 1.0\n"
14
13
  "Content-Type: text/plain; charset=UTF-8\n"
15
14
  "Content-Transfer-Encoding: \n"
16
15
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
- "X-Generator: Weblate 5.10.4\n"
18
16
 
19
17
  #. module: analytic_hr_department_restriction
20
18
  #: model:ir.model,name:analytic_hr_department_restriction.model_account_analytic_account
21
19
  msgid "Analytic Account"
22
- msgstr "Conto analitico"
20
+ msgstr ""
23
21
 
24
22
  #. module: analytic_hr_department_restriction
25
23
  #: model:res.groups,name:analytic_hr_department_restriction.group_analytic_accounting_without_department
26
24
  msgid "Analytic Accounting (without department)"
27
- msgstr "Contabilità analitica (senza reparto)"
25
+ msgstr ""
28
26
 
29
27
  #. module: analytic_hr_department_restriction
30
28
  #: model:ir.model,name:analytic_hr_department_restriction.model_account_analytic_plan
31
29
  msgid "Analytic Plans"
32
- msgstr "Piani analitici"
30
+ msgstr ""
33
31
 
34
32
  #. module: analytic_hr_department_restriction
35
33
  #: model:ir.model.fields,field_description:analytic_hr_department_restriction.field_account_analytic_account__department_id
36
34
  #: model:ir.model.fields,field_description:analytic_hr_department_restriction.field_account_analytic_plan__department_id
37
35
  #: model_terms:ir.ui.view,arch_db:analytic_hr_department_restriction.view_account_analytic_account_search
38
36
  msgid "Department"
39
- msgstr "Reparto"
37
+ msgstr ""
40
38
 
41
39
  #. module: analytic_hr_department_restriction
42
40
  #: model:ir.model,name:analytic_hr_department_restriction.model_ir_rule
43
41
  msgid "Record Rule"
44
- msgstr "Regola su record"
42
+ msgstr ""
@@ -0,0 +1,16 @@
1
+ # Copyright 2025 Tecnativa - Víctor Martínez
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
+
4
+ from openupgradelib import openupgrade
5
+
6
+ from odoo.tools.sql import column_exists
7
+
8
+
9
+ @openupgrade.migrate()
10
+ def migrate(env, version):
11
+ """Set the department_id value in the project company."""
12
+ if not column_exists(env.cr, "account_analytic_plan", "old_department_id"):
13
+ return
14
+ openupgrade.convert_to_company_dependent(
15
+ env, "account.analytic.plan", "old_department_id", "department_id"
16
+ )
@@ -0,0 +1,17 @@
1
+ # Copyright 2025 Tecnativa - Víctor Martínez
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
+
4
+ from openupgradelib import openupgrade
5
+
6
+ from odoo.tools.sql import column_exists
7
+
8
+ column_renames = {
9
+ "account_analytic_plan": [("department_id", "old_department_id")],
10
+ }
11
+
12
+
13
+ @openupgrade.migrate()
14
+ def migrate(env, version):
15
+ """Rename the column to keep the old value."""
16
+ if column_exists(env.cr, "account_analytic_plan", "department_id"):
17
+ openupgrade.rename_columns(env.cr, column_renames)
@@ -2,6 +2,7 @@
2
2
  # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
3
 
4
4
  from odoo import fields, models
5
+ from odoo.tools import config
5
6
 
6
7
 
7
8
  class AccountAnalyticPlan(models.Model):
@@ -10,5 +11,18 @@ class AccountAnalyticPlan(models.Model):
10
11
  department_id = fields.Many2one(
11
12
  comodel_name="hr.department",
12
13
  string="Department",
13
- domain="['|',('company_id', '=?', company_id),('company_id', '=', False)]",
14
+ company_dependent=True,
14
15
  )
16
+
17
+ def _get_all_plans(self):
18
+ """We need to do the search again to avoid possible access errors.
19
+ This is because the __get_all_plans() method gets all plans with .sudo() and
20
+ therefore does not filter properly."""
21
+ project_plan, other_plans = super()._get_all_plans()
22
+ test_condition = not config["test_enable"] or self.env.context.get(
23
+ "test_analytic_hr_department_restriction"
24
+ )
25
+ if test_condition:
26
+ project_plan = self.search([("id", "in", project_plan.ids)])
27
+ other_plans = self.search([("id", "in", other_plans.ids)])
28
+ return project_plan, other_plans
@@ -28,7 +28,7 @@ class IrRule(models.Model):
28
28
  user = self.env.user
29
29
  group1 = "base.group_user"
30
30
  group2 = "analytic.group_analytic_accounting"
31
- group3 = "analytic_hr_department_restriction.group_analytic_accounting_without_department" # noqa: B950
31
+ group3 = "analytic_hr_department_restriction.group_analytic_accounting_without_department" # noqa: E501
32
32
  group4 = "account.group_account_invoice"
33
33
  test_condition = not config["test_enable"] or self.env.context.get(
34
34
  "test_analytic_hr_department_restriction"
@@ -1,2 +1,2 @@
1
1
  - Your user must have the "Analytic Accounting" permission.
2
- - Create an employee linked to your user with a defined department.
2
+ - Create an employee linked to your user with a defined department.
@@ -0,0 +1,3 @@
1
+ - [Tecnativa](https://www.tecnativa.com):
2
+ - Víctor Martínez
3
+ - Pedro M. Baeza
@@ -0,0 +1,8 @@
1
+ This module allows you to limit plans and analytical accounts by
2
+ employee departments.
3
+
4
+ Users will only be able to view plans and analytical accounts linked to
5
+ their employee's department or those with no department defined.
6
+
7
+ Users with the "Invoicing / Invoicing" permission will be able to view all
8
+ plans and analytical accounts without restrictions.
@@ -0,0 +1,11 @@
1
+ 1. Go to an analytical plan/account and define your employee's
2
+ department.
3
+ 2. Go to an analytical plan/account and define a different department
4
+ than your employee's department.
5
+ 3. Go to an analytical plan/account and leave the department empty.
6
+ 4. Users without the "Invoicing / Invoicing" permission will be able to
7
+ see only the plans/analytical accounts of the user's employee's
8
+ department.
9
+ 5. Users with the "Analytic Accounting (without department)" will be
10
+ able to view the plans/analytical accounts without a department, as
11
+ will users with the permission "Invoicing / Invoicing".
@@ -367,12 +367,15 @@ ul.auto-toc {
367
367
  !! This file is generated by oca-gen-addon-readme !!
368
368
  !! changes will be overwritten. !!
369
369
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:bb538fc6b059dbce7461cad0af90c29efadbb98b14482a9535a25d4db428127c
370
+ !! source digest: sha256:2f165ed1c2775074c2ea2df1c27ee4a6504ccb60f87efe765360770481b69158
371
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
- <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-analytic/tree/16.0/analytic_hr_department_restriction"><img alt="OCA/account-analytic" src="https://img.shields.io/badge/github-OCA%2Faccount--analytic-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-analytic_hr_department_restriction"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-analytic&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
- <p>This module allows you to limit plans and analytical accounts by employee departments.</p>
374
- <p>Users will only be able to view plans and analytical accounts linked to their employee’s department or those with no department defined.</p>
375
- <p>Users with the “Invoicing / Billing” permission will be able to view all plans and analytical accounts without restrictions.</p>
372
+ <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-analytic/tree/18.0/analytic_hr_department_restriction"><img alt="OCA/account-analytic" src="https://img.shields.io/badge/github-OCA%2Faccount--analytic-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-analytic-18-0/account-analytic-18-0-analytic_hr_department_restriction"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-analytic&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
+ <p>This module allows you to limit plans and analytical accounts by
374
+ employee departments.</p>
375
+ <p>Users will only be able to view plans and analytical accounts linked to
376
+ their employee’s department or those with no department defined.</p>
377
+ <p>Users with the “Invoicing / Invoicing” permission will be able to view
378
+ all plans and analytical accounts without restrictions.</p>
376
379
  <p><strong>Table of contents</strong></p>
377
380
  <div class="contents local topic" id="contents">
378
381
  <ul class="simple">
@@ -397,11 +400,17 @@ ul.auto-toc {
397
400
  <div class="section" id="usage">
398
401
  <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
399
402
  <ol class="arabic simple">
400
- <li>Go to an analytical plan/account and define your employee’s department.</li>
401
- <li>Go to an analytical plan/account and define a different department than your employee’s department.</li>
403
+ <li>Go to an analytical plan/account and define your employee’s
404
+ department.</li>
405
+ <li>Go to an analytical plan/account and define a different department
406
+ than your employee’s department.</li>
402
407
  <li>Go to an analytical plan/account and leave the department empty.</li>
403
- <li>Users without the “Invoicing / Billing” permission will be able to see only the plans/analytical accounts of the user’s employee’s department.</li>
404
- <li>Users with the “Analytic Accounting (without department)” will be able to view the plans/analytical accounts without a department, as will users with the permission “Invoicing / Billing”.</li>
408
+ <li>Users without the “Invoicing / Invoicing” permission will be able to
409
+ see only the plans/analytical accounts of the user’s employee’s
410
+ department.</li>
411
+ <li>Users with the “Analytic Accounting (without department)” will be
412
+ able to view the plans/analytical accounts without a department, as
413
+ will users with the permission “Invoicing / Invoicing”.</li>
405
414
  </ol>
406
415
  </div>
407
416
  <div class="section" id="bug-tracker">
@@ -409,7 +418,7 @@ ul.auto-toc {
409
418
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-analytic/issues">GitHub Issues</a>.
410
419
  In case of trouble, please check there if your issue has already been reported.
411
420
  If you spotted it first, help us to smash it by providing a detailed and welcomed
412
- <a class="reference external" href="https://github.com/OCA/account-analytic/issues/new?body=module:%20analytic_hr_department_restriction%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
421
+ <a class="reference external" href="https://github.com/OCA/account-analytic/issues/new?body=module:%20analytic_hr_department_restriction%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
413
422
  <p>Do not contact contributors directly about support or help with technical issues.</p>
414
423
  </div>
415
424
  <div class="section" id="credits">
@@ -441,7 +450,7 @@ mission is to support the collaborative development of Odoo features and
441
450
  promote its widespread use.</p>
442
451
  <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
443
452
  <p><a class="reference external image-reference" href="https://github.com/victoralmau"><img alt="victoralmau" src="https://github.com/victoralmau.png?size=40px" /></a></p>
444
- <p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-analytic/tree/16.0/analytic_hr_department_restriction">OCA/account-analytic</a> project on GitHub.</p>
453
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-analytic/tree/18.0/analytic_hr_department_restriction">OCA/account-analytic</a> project on GitHub.</p>
445
454
  <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
446
455
  </div>
447
456
  </div>
@@ -77,7 +77,6 @@ class TestAnalyticHrDepartmentRestriction(BaseCommon):
77
77
  {
78
78
  "name": "Test plan A",
79
79
  "department_id": cls.department_a.id,
80
- "company_id": cls.env.company.id,
81
80
  }
82
81
  )
83
82
  cls.account_a = cls.env["account.analytic.account"].create(
@@ -92,7 +91,6 @@ class TestAnalyticHrDepartmentRestriction(BaseCommon):
92
91
  {
93
92
  "name": "Test plan B",
94
93
  "department_id": cls.department_b.id,
95
- "company_id": cls.env.company.id,
96
94
  }
97
95
  )
98
96
  cls.account_b = cls.env["account.analytic.account"].create(
@@ -103,12 +101,7 @@ class TestAnalyticHrDepartmentRestriction(BaseCommon):
103
101
  "company_id": cls.env.company.id,
104
102
  }
105
103
  )
106
- cls.plan_c = cls.env["account.analytic.plan"].create(
107
- {
108
- "name": "Test plan C",
109
- "company_id": cls.env.company.id,
110
- }
111
- )
104
+ cls.plan_c = cls.env["account.analytic.plan"].create({"name": "Test plan C"})
112
105
  cls.account_c = cls.env["account.analytic.account"].create(
113
106
  {
114
107
  "name": "Test account C",
@@ -149,10 +142,13 @@ class TestAnalyticHrDepartmentRestriction(BaseCommon):
149
142
  # - No access error should be displayed and the user should be able to see
150
143
  # the corresponding plan/analytic account even if the employee's company
151
144
  # is not selected.
152
- self.plan_a.company_id = False
153
145
  self.department_a.company_id = False
154
- self.plan_b.company_id = False
155
- self.plan_c.company_id = False
146
+ self.plan_a.with_company(
147
+ self.company_extra.id
148
+ ).department_id = self.department_a
149
+ self.plan_b.with_company(
150
+ self.company_extra.id
151
+ ).department_id = self.department_b
156
152
  plans = (
157
153
  self.env["account.analytic.plan"]
158
154
  .with_company(self.company_extra.id)
@@ -173,6 +169,17 @@ class TestAnalyticHrDepartmentRestriction(BaseCommon):
173
169
  self.assertNotIn(self.account_b, accounts)
174
170
  self.assertNotIn(self.account_c, accounts)
175
171
 
172
+ @users("test-user")
173
+ def test_get_relevant_plans(self):
174
+ self.plan_a.department_id = False
175
+ items = self.env["account.analytic.plan"].get_relevant_plans(
176
+ business_domain="general"
177
+ )
178
+ plan_ids = [item["id"] for item in items]
179
+ self.assertNotIn(self.plan_a.id, plan_ids)
180
+ self.assertNotIn(self.plan_b.id, plan_ids)
181
+ self.assertNotIn(self.plan_c.id, plan_ids)
182
+
176
183
  @users("test-user_extra")
177
184
  def test_analytic_data_user_extra(self):
178
185
  plans = self.env["account.analytic.plan"].search([])
@@ -4,21 +4,16 @@
4
4
  <field name="model">account.analytic.plan</field>
5
5
  <field name="inherit_id" ref="analytic.account_analytic_plan_form_view" />
6
6
  <field name="arch" type="xml">
7
- <xpath expr="//group//field[@name='company_id']" position="before">
7
+ <field name="color" position="after">
8
8
  <field name="department_id" groups="account.group_account_invoice" />
9
- </xpath>
9
+ </field>
10
10
  </field>
11
11
  </record>
12
12
  <record id="account_analytic_plan_tree_view" model="ir.ui.view">
13
13
  <field name="model">account.analytic.plan</field>
14
14
  <field name="inherit_id" ref="analytic.account_analytic_plan_tree_view" />
15
15
  <field name="arch" type="xml">
16
- <field name="company_id" position="before">
17
- <field
18
- name="company_id"
19
- invisible="1"
20
- groups="!base.group_multi_company"
21
- />
16
+ <field name="color" position="after">
22
17
  <field
23
18
  name="department_id"
24
19
  groups="account.group_account_invoice"
@@ -1,17 +1,17 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-analytic_hr_department_restriction
3
- Version: 16.0.1.0.1.1
3
+ Version: 18.0.1.0.0.3
4
+ Requires-Python: >=3.10
5
+ Requires-Dist: odoo==18.0.*
4
6
  Summary: Analytic distributions restriction per HR department
5
7
  Home-page: https://github.com/OCA/account-analytic
8
+ License: AGPL-3
6
9
  Author: Tecnativa, Odoo Community Association (OCA)
7
10
  Author-email: support@odoo-community.org
8
- License: AGPL-3
9
11
  Classifier: Programming Language :: Python
10
12
  Classifier: Framework :: Odoo
11
- Classifier: Framework :: Odoo :: 16.0
13
+ Classifier: Framework :: Odoo :: 18.0
12
14
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3
13
- Requires-Python: >=3.10
14
- Requires-Dist: odoo<16.1dev,>=16.0a
15
15
 
16
16
  ====================================================
17
17
  Analytic distributions restriction per HR department
@@ -22,7 +22,7 @@ Analytic distributions restriction per HR department
22
22
  !! This file is generated by oca-gen-addon-readme !!
23
23
  !! changes will be overwritten. !!
24
24
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
25
- !! source digest: sha256:bb538fc6b059dbce7461cad0af90c29efadbb98b14482a9535a25d4db428127c
25
+ !! source digest: sha256:2f165ed1c2775074c2ea2df1c27ee4a6504ccb60f87efe765360770481b69158
26
26
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27
27
 
28
28
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -32,22 +32,25 @@ Analytic distributions restriction per HR department
32
32
  :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
33
33
  :alt: License: AGPL-3
34
34
  .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--analytic-lightgray.png?logo=github
35
- :target: https://github.com/OCA/account-analytic/tree/16.0/analytic_hr_department_restriction
35
+ :target: https://github.com/OCA/account-analytic/tree/18.0/analytic_hr_department_restriction
36
36
  :alt: OCA/account-analytic
37
37
  .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
38
- :target: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-analytic_hr_department_restriction
38
+ :target: https://translation.odoo-community.org/projects/account-analytic-18-0/account-analytic-18-0-analytic_hr_department_restriction
39
39
  :alt: Translate me on Weblate
40
40
  .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
41
- :target: https://runboat.odoo-community.org/builds?repo=OCA/account-analytic&target_branch=16.0
41
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/account-analytic&target_branch=18.0
42
42
  :alt: Try me on Runboat
43
43
 
44
44
  |badge1| |badge2| |badge3| |badge4| |badge5|
45
45
 
46
- This module allows you to limit plans and analytical accounts by employee departments.
46
+ This module allows you to limit plans and analytical accounts by
47
+ employee departments.
47
48
 
48
- Users will only be able to view plans and analytical accounts linked to their employee's department or those with no department defined.
49
+ Users will only be able to view plans and analytical accounts linked to
50
+ their employee's department or those with no department defined.
49
51
 
50
- Users with the "Invoicing / Billing" permission will be able to view all plans and analytical accounts without restrictions.
52
+ Users with the "Invoicing / Invoicing" permission will be able to view
53
+ all plans and analytical accounts without restrictions.
51
54
 
52
55
  **Table of contents**
53
56
 
@@ -63,11 +66,17 @@ Configuration
63
66
  Usage
64
67
  =====
65
68
 
66
- #. Go to an analytical plan/account and define your employee's department.
67
- #. Go to an analytical plan/account and define a different department than your employee's department.
68
- #. Go to an analytical plan/account and leave the department empty.
69
- #. Users without the "Invoicing / Billing" permission will be able to see only the plans/analytical accounts of the user's employee's department.
70
- #. Users with the "Analytic Accounting (without department)" will be able to view the plans/analytical accounts without a department, as will users with the permission "Invoicing / Billing".
69
+ 1. Go to an analytical plan/account and define your employee's
70
+ department.
71
+ 2. Go to an analytical plan/account and define a different department
72
+ than your employee's department.
73
+ 3. Go to an analytical plan/account and leave the department empty.
74
+ 4. Users without the "Invoicing / Invoicing" permission will be able to
75
+ see only the plans/analytical accounts of the user's employee's
76
+ department.
77
+ 5. Users with the "Analytic Accounting (without department)" will be
78
+ able to view the plans/analytical accounts without a department, as
79
+ will users with the permission "Invoicing / Invoicing".
71
80
 
72
81
  Bug Tracker
73
82
  ===========
@@ -75,7 +84,7 @@ Bug Tracker
75
84
  Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-analytic/issues>`_.
76
85
  In case of trouble, please check there if your issue has already been reported.
77
86
  If you spotted it first, help us to smash it by providing a detailed and welcomed
78
- `feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20analytic_hr_department_restriction%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
87
+ `feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20analytic_hr_department_restriction%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
79
88
 
80
89
  Do not contact contributors directly about support or help with technical issues.
81
90
 
@@ -83,20 +92,20 @@ Credits
83
92
  =======
84
93
 
85
94
  Authors
86
- ~~~~~~~
95
+ -------
87
96
 
88
97
  * Tecnativa
89
98
 
90
99
  Contributors
91
- ~~~~~~~~~~~~
100
+ ------------
92
101
 
93
- * `Tecnativa <https://www.tecnativa.com>`__:
102
+ - `Tecnativa <https://www.tecnativa.com>`__:
94
103
 
95
- * Víctor Martínez
96
- * Pedro M. Baeza
104
+ - Víctor Martínez
105
+ - Pedro M. Baeza
97
106
 
98
107
  Maintainers
99
- ~~~~~~~~~~~
108
+ -----------
100
109
 
101
110
  This module is maintained by the OCA.
102
111
 
@@ -116,6 +125,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
116
125
 
117
126
  |maintainer-victoralmau|
118
127
 
119
- This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/16.0/analytic_hr_department_restriction>`_ project on GitHub.
128
+ This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/18.0/analytic_hr_department_restriction>`_ project on GitHub.
120
129
 
121
130
  You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
@@ -1,25 +1,27 @@
1
- odoo/addons/analytic_hr_department_restriction/README.rst,sha256=O3wfPkJTX9bpwHXk0FTQQ_2eycLnfrkaCwQ8qiwHTO0,4382
1
+ odoo/addons/analytic_hr_department_restriction/README.rst,sha256=F8c-K-iJBXAAhhmd-TS17fhMCM_gh4em9QXaBtK7Mog,4406
2
2
  odoo/addons/analytic_hr_department_restriction/__init__.py,sha256=X9EJGOE2GtZbS0G82PtSXmWSZ_R8jEM0rlJTDliQjp4,21
3
- odoo/addons/analytic_hr_department_restriction/__manifest__.py,sha256=rqQxqVq9sRl1DtzW25bjjLqQ-TYlhJ14lRsws4Cumo4,632
4
- odoo/addons/analytic_hr_department_restriction/i18n/analytic_hr_department_restriction.pot,sha256=IVLgb5OOVyJJuK_w6GaMb72G1VnYFpQp7hyh-VGHHf0,1505
3
+ odoo/addons/analytic_hr_department_restriction/__manifest__.py,sha256=SPgKOu7nDDO1iNPEbpzUazLrNEmRAocGPiYdHfDpNvg,632
4
+ odoo/addons/analytic_hr_department_restriction/i18n/analytic_hr_department_restriction.pot,sha256=FtYpW46_Ooe1Rnd9M01lplsOseiu9Z_d9M4Hx8dlDDQ,1505
5
5
  odoo/addons/analytic_hr_department_restriction/i18n/es.po,sha256=-sGYwxp6Pc6sIlZwbM3uJHCCXXeoC55sw9HzYJDgQ5A,1585
6
- odoo/addons/analytic_hr_department_restriction/i18n/it.po,sha256=HMsRgkAcNJs65FXIkHmK7S9lTvlez0aNzBXzilvsOLo,1755
6
+ odoo/addons/analytic_hr_department_restriction/i18n/it.po,sha256=5FM3s1MWeMX9Nx8gVWBA17vHtRoCZ41ahp3OjwhwSmc,1575
7
+ odoo/addons/analytic_hr_department_restriction/migrations/18.0.1.0.0/post-migration.py,sha256=kj2ryIGcGqp9_gOqlrt84dOzT45YnDt1lV5X8veQ67M,529
8
+ odoo/addons/analytic_hr_department_restriction/migrations/18.0.1.0.0/pre-migration.py,sha256=dfz7WFunAK8h44rYZOhpVkrDJwYXrBTKUL9tUbHweIk,520
7
9
  odoo/addons/analytic_hr_department_restriction/models/__init__.py,sha256=Dd5CV80qJ4N-DNWSSLVB8_1O4g52NI1BcAD6dKUZ8C8,162
8
10
  odoo/addons/analytic_hr_department_restriction/models/account_analytic_account.py,sha256=OJz2W0lwN_2-i8Ray_gNkM9aH_kQ6g8_nNzdLmCm1Vs,428
9
- odoo/addons/analytic_hr_department_restriction/models/account_analytic_plan.py,sha256=p_K0Texwdf1-RqCLHD9p-qyWwhCkbzuJo_j_16Js5ZE,422
10
- odoo/addons/analytic_hr_department_restriction/models/ir_rule.py,sha256=hFMmgr33K41BdMTGhhLAF_mcpVXAw0a95m7AejJw5M8,2856
11
- odoo/addons/analytic_hr_department_restriction/readme/CONFIGURE.rst,sha256=cZJpECvRUAD5PNOUOjGkPLXpd2rBkoHEk63OSOjpwKY,127
12
- odoo/addons/analytic_hr_department_restriction/readme/CONTRIBUTORS.rst,sha256=A-ePkWzxL7sfk2futLXfYllbnSRrZzTeeJCNg_snLDo,86
13
- odoo/addons/analytic_hr_department_restriction/readme/DESCRIPTION.rst,sha256=_AIO2kymt1cEs5uL-oPiUw7Qs_bCuSSluW6QmWLOs3I,350
14
- odoo/addons/analytic_hr_department_restriction/readme/USAGE.rst,sha256=YBFF35tDh8dViMdrwn_p7TZ9WK1mHIX544mxR9cov0Q,582
11
+ odoo/addons/analytic_hr_department_restriction/models/account_analytic_plan.py,sha256=AkSPXXEJXrumg-lxzXZUUci674vSPubywYJtU4YGZzw,1051
12
+ odoo/addons/analytic_hr_department_restriction/models/ir_rule.py,sha256=bnYrlGtqgOzs1ub_PeepeJfUrvMj7_SAib6Ex9HylgM,2856
13
+ odoo/addons/analytic_hr_department_restriction/readme/CONFIGURE.md,sha256=bicPK24dCKqRFMJ3xXKM2vNEju-uasXlnrSE24urpeM,128
14
+ odoo/addons/analytic_hr_department_restriction/readme/CONTRIBUTORS.md,sha256=7B3TJAW9bVCbc9-u4HKUamqJSM0J1p_Z_47T3M3uXxE,83
15
+ odoo/addons/analytic_hr_department_restriction/readme/DESCRIPTION.md,sha256=cxZ4eI1mlsDZkPyu0QmcMVWYJjyZ6xJTe9dehYQCobc,353
16
+ odoo/addons/analytic_hr_department_restriction/readme/USAGE.md,sha256=11Gy5xQS9G0RYKuaPkxbccnA24_u1ixv3rksbMIUUeY,616
15
17
  odoo/addons/analytic_hr_department_restriction/security/groups.xml,sha256=dN536AJfIOSRjUafmSvWpYGpqTV5no6DlLrh682yrug,423
16
18
  odoo/addons/analytic_hr_department_restriction/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
17
- odoo/addons/analytic_hr_department_restriction/static/description/index.html,sha256=o0pv53gNxsI5NBEVPlwoxxao3Rat5EWdjmjP-nXV21g,14199
19
+ odoo/addons/analytic_hr_department_restriction/static/description/index.html,sha256=wDMFNvvCxNKdm42Ba1UoPN6X4VTGw9jVtIXq2V4IWEM,14205
18
20
  odoo/addons/analytic_hr_department_restriction/tests/__init__.py,sha256=l6JUuT5fLrb_xYWQW-GbLXl7g0cQ3sBAdRxC5EsP8Aw,166
19
- odoo/addons/analytic_hr_department_restriction/tests/test_analytic_hr_department_restriction.py,sha256=3rW0QarvaC1IoZYePJNyp6j5-h_rDrdZxkosM2RpPds,7305
21
+ odoo/addons/analytic_hr_department_restriction/tests/test_analytic_hr_department_restriction.py,sha256=-PgwqKmbS8tfA37My12N-obX8aoOXZuJZUNfBHera80,7636
20
22
  odoo/addons/analytic_hr_department_restriction/views/account_analytic_account_views.xml,sha256=IY6E8D5r5o4drFmOqaDq_tqnoFpzVSDT638AVUiq-98,1866
21
- odoo/addons/analytic_hr_department_restriction/views/account_analytic_plan_views.xml,sha256=wqfrwdIDyXJZTDpZdxhiUYFEo--sQeDrTKxHZu7UbD4,1226
22
- odoo_addon_analytic_hr_department_restriction-16.0.1.0.1.1.dist-info/METADATA,sha256=OF8ZF2EnkoY2AcGwtWCtA4VxyKZfSEjKRpuuT1e51dU,4948
23
- odoo_addon_analytic_hr_department_restriction-16.0.1.0.1.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
24
- odoo_addon_analytic_hr_department_restriction-16.0.1.0.1.1.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
25
- odoo_addon_analytic_hr_department_restriction-16.0.1.0.1.1.dist-info/RECORD,,
23
+ odoo/addons/analytic_hr_department_restriction/views/account_analytic_plan_views.xml,sha256=GUw5oCe4M_1qwH9RH8oSDkYuL9S1HseoLH6eBRVhTIs,1021
24
+ odoo_addon_analytic_hr_department_restriction-18.0.1.0.0.3.dist-info/METADATA,sha256=R8zTDz0jjfRWnvrwE2ZaAlqUPoaigN-gRfQoRj75ask,4964
25
+ odoo_addon_analytic_hr_department_restriction-18.0.1.0.0.3.dist-info/WHEEL,sha256=9fEMia4zL7ZuZbnCOrcYogUhmn4XFIVaJ8G4YGI31xc,81
26
+ odoo_addon_analytic_hr_department_restriction-18.0.1.0.0.3.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
27
+ odoo_addon_analytic_hr_department_restriction-18.0.1.0.0.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.1)
2
+ Generator: Whool 1.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,4 +0,0 @@
1
- * `Tecnativa <https://www.tecnativa.com>`__:
2
-
3
- * Víctor Martínez
4
- * Pedro M. Baeza
@@ -1,5 +0,0 @@
1
- This module allows you to limit plans and analytical accounts by employee departments.
2
-
3
- Users will only be able to view plans and analytical accounts linked to their employee's department or those with no department defined.
4
-
5
- Users with the "Invoicing / Billing" permission will be able to view all plans and analytical accounts without restrictions.
@@ -1,5 +0,0 @@
1
- #. Go to an analytical plan/account and define your employee's department.
2
- #. Go to an analytical plan/account and define a different department than your employee's department.
3
- #. Go to an analytical plan/account and leave the department empty.
4
- #. Users without the "Invoicing / Billing" permission will be able to see only the plans/analytical accounts of the user's employee's department.
5
- #. Users with the "Analytic Accounting (without department)" will be able to view the plans/analytical accounts without a department, as will users with the permission "Invoicing / Billing".