odoo-addon-analytic-hr-department-restriction 16.0.1.0.0.3__py3-none-any.whl → 16.0.1.0.1.1__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.
@@ -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:e787f119827c6a3cd07a0d80cd200c9f1aea5dc339e7ef2fa58277891f410915
10
+ !! source digest: sha256:bb538fc6b059dbce7461cad0af90c29efadbb98b14482a9535a25d4db428127c
11
11
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
 
13
13
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -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.0",
7
+ "version": "16.0.1.0.1",
8
8
  "depends": ["account", "hr"],
9
9
  "license": "AGPL-3",
10
10
  "category": "Account",
@@ -6,37 +6,39 @@ msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: Odoo Server 16.0\n"
8
8
  "Report-Msgid-Bugs-To: \n"
9
- "Last-Translator: Automatically generated\n"
9
+ "PO-Revision-Date: 2025-05-10 10:24+0000\n"
10
+ "Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
10
11
  "Language-Team: none\n"
11
12
  "Language: it\n"
12
13
  "MIME-Version: 1.0\n"
13
14
  "Content-Type: text/plain; charset=UTF-8\n"
14
15
  "Content-Transfer-Encoding: \n"
15
16
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
+ "X-Generator: Weblate 5.10.4\n"
16
18
 
17
19
  #. module: analytic_hr_department_restriction
18
20
  #: model:ir.model,name:analytic_hr_department_restriction.model_account_analytic_account
19
21
  msgid "Analytic Account"
20
- msgstr ""
22
+ msgstr "Conto analitico"
21
23
 
22
24
  #. module: analytic_hr_department_restriction
23
25
  #: model:res.groups,name:analytic_hr_department_restriction.group_analytic_accounting_without_department
24
26
  msgid "Analytic Accounting (without department)"
25
- msgstr ""
27
+ msgstr "Contabilità analitica (senza reparto)"
26
28
 
27
29
  #. module: analytic_hr_department_restriction
28
30
  #: model:ir.model,name:analytic_hr_department_restriction.model_account_analytic_plan
29
31
  msgid "Analytic Plans"
30
- msgstr ""
32
+ msgstr "Piani analitici"
31
33
 
32
34
  #. module: analytic_hr_department_restriction
33
35
  #: model:ir.model.fields,field_description:analytic_hr_department_restriction.field_account_analytic_account__department_id
34
36
  #: model:ir.model.fields,field_description:analytic_hr_department_restriction.field_account_analytic_plan__department_id
35
37
  #: model_terms:ir.ui.view,arch_db:analytic_hr_department_restriction.view_account_analytic_account_search
36
38
  msgid "Department"
37
- msgstr ""
39
+ msgstr "Reparto"
38
40
 
39
41
  #. module: analytic_hr_department_restriction
40
42
  #: model:ir.model,name:analytic_hr_department_restriction.model_ir_rule
41
43
  msgid "Record Rule"
42
- msgstr ""
44
+ msgstr "Regola su record"
@@ -40,6 +40,20 @@ class IrRule(models.Model):
40
40
  and not user.has_group(group4)
41
41
  and test_condition
42
42
  ):
43
+ # We need to get all possible employees of the user in any company (even
44
+ # if not defined in allowed_company_ids).
45
+ # Example of use case:
46
+ # - User: Company A + Company B
47
+ # - Employee: Company A
48
+ # - Department: Without company
49
+ # - Plan: Wihout company + Department
50
+ # - Purchase Order: Company A + Plan + Department
51
+ # - If the user accesses the purchase order only with company A, he/she
52
+ # should be able to see the plan and/or the analytical accounts.
53
+ # Note: We need to override employee_ids so that when we pass it the
54
+ # allowed_company_ids context it will return the appropriate value.
55
+ user.invalidate_recordset(["employee_ids"])
56
+ user = user.with_context(allowed_company_ids=user.company_ids.ids)
43
57
  if user.has_group(group2):
44
58
  extra_domain = [
45
59
  ("department_id", "child_of", user.employee_ids.department_id.ids)
@@ -367,7 +367,7 @@ 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:e787f119827c6a3cd07a0d80cd200c9f1aea5dc339e7ef2fa58277891f410915
370
+ !! source digest: sha256:bb538fc6b059dbce7461cad0af90c29efadbb98b14482a9535a25d4db428127c
371
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
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
373
  <p>This module allows you to limit plans and analytical accounts by employee departments.</p>
@@ -1,5 +1,6 @@
1
1
  # Copyright 2025 Tecnativa - Víctor Martínez
2
2
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
+ from odoo import Command
3
4
  from odoo.tests import new_test_user
4
5
  from odoo.tests.common import users
5
6
 
@@ -115,6 +116,10 @@ class TestAnalyticHrDepartmentRestriction(BaseCommon):
115
116
  "company_id": cls.env.company.id,
116
117
  }
117
118
  )
119
+ cls.company_extra = cls.env["res.company"].create(
120
+ {"name": "Test company extra"}
121
+ )
122
+ cls.user.write({"company_ids": [Command.link(cls.company_extra.id)]})
118
123
 
119
124
  @users("test-basic_user")
120
125
  def test_analytic_data_basic_user(self):
@@ -134,6 +139,40 @@ class TestAnalyticHrDepartmentRestriction(BaseCommon):
134
139
  self.assertNotIn(self.account_b, accounts)
135
140
  self.assertNotIn(self.account_c, accounts)
136
141
 
142
+ @users("test-user")
143
+ def test_analytic_data_user_multi_company(self):
144
+ # Example of use case:
145
+ # - User with access to several companies.
146
+ # - Employee defined in one company
147
+ # - Department and plan with no company defined
148
+ # - Purchase order linked to company A (different from the user's employee).
149
+ # - No access error should be displayed and the user should be able to see
150
+ # the corresponding plan/analytic account even if the employee's company
151
+ # is not selected.
152
+ self.plan_a.company_id = False
153
+ self.department_a.company_id = False
154
+ self.plan_b.company_id = False
155
+ self.plan_c.company_id = False
156
+ plans = (
157
+ self.env["account.analytic.plan"]
158
+ .with_company(self.company_extra.id)
159
+ .search([])
160
+ )
161
+ self.assertIn(self.plan_a, plans)
162
+ self.assertNotIn(self.plan_b, plans)
163
+ self.assertNotIn(self.plan_c, plans)
164
+ self.account_a.company_id = False
165
+ self.account_b.company_id = False
166
+ self.account_c.company_id = False
167
+ accounts = (
168
+ self.env["account.analytic.account"]
169
+ .with_company(self.company_extra.id)
170
+ .search([])
171
+ )
172
+ self.assertIn(self.account_a, accounts)
173
+ self.assertNotIn(self.account_b, accounts)
174
+ self.assertNotIn(self.account_c, accounts)
175
+
137
176
  @users("test-user_extra")
138
177
  def test_analytic_data_user_extra(self):
139
178
  plans = self.env["account.analytic.plan"].search([])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-analytic_hr_department_restriction
3
- Version: 16.0.1.0.0.3
3
+ Version: 16.0.1.0.1.1
4
4
  Summary: Analytic distributions restriction per HR department
5
5
  Home-page: https://github.com/OCA/account-analytic
6
6
  Author: Tecnativa, Odoo Community Association (OCA)
@@ -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:e787f119827c6a3cd07a0d80cd200c9f1aea5dc339e7ef2fa58277891f410915
25
+ !! source digest: sha256:bb538fc6b059dbce7461cad0af90c29efadbb98b14482a9535a25d4db428127c
26
26
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27
27
 
28
28
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -1,25 +1,25 @@
1
- odoo/addons/analytic_hr_department_restriction/README.rst,sha256=rwxO2EtgDxTrK_v-Yqn7hescD-eIm6PPUGQVrxPrKU0,4382
1
+ odoo/addons/analytic_hr_department_restriction/README.rst,sha256=O3wfPkJTX9bpwHXk0FTQQ_2eycLnfrkaCwQ8qiwHTO0,4382
2
2
  odoo/addons/analytic_hr_department_restriction/__init__.py,sha256=X9EJGOE2GtZbS0G82PtSXmWSZ_R8jEM0rlJTDliQjp4,21
3
- odoo/addons/analytic_hr_department_restriction/__manifest__.py,sha256=xizPVX4FDKNtyhENV4mt77_zzaL7XLq4M40GBOSRQlo,632
3
+ odoo/addons/analytic_hr_department_restriction/__manifest__.py,sha256=rqQxqVq9sRl1DtzW25bjjLqQ-TYlhJ14lRsws4Cumo4,632
4
4
  odoo/addons/analytic_hr_department_restriction/i18n/analytic_hr_department_restriction.pot,sha256=IVLgb5OOVyJJuK_w6GaMb72G1VnYFpQp7hyh-VGHHf0,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=0khuyEtDfjc5c2g7ROf1EcxXcVFH1IlKGaEC495yVTQ,1575
6
+ odoo/addons/analytic_hr_department_restriction/i18n/it.po,sha256=HMsRgkAcNJs65FXIkHmK7S9lTvlez0aNzBXzilvsOLo,1755
7
7
  odoo/addons/analytic_hr_department_restriction/models/__init__.py,sha256=Dd5CV80qJ4N-DNWSSLVB8_1O4g52NI1BcAD6dKUZ8C8,162
8
8
  odoo/addons/analytic_hr_department_restriction/models/account_analytic_account.py,sha256=OJz2W0lwN_2-i8Ray_gNkM9aH_kQ6g8_nNzdLmCm1Vs,428
9
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=LGnrCIQY3u_Lks0tIuGXl3GJ5hj3xxdf76h9Hfkoi9I,1989
10
+ odoo/addons/analytic_hr_department_restriction/models/ir_rule.py,sha256=hFMmgr33K41BdMTGhhLAF_mcpVXAw0a95m7AejJw5M8,2856
11
11
  odoo/addons/analytic_hr_department_restriction/readme/CONFIGURE.rst,sha256=cZJpECvRUAD5PNOUOjGkPLXpd2rBkoHEk63OSOjpwKY,127
12
12
  odoo/addons/analytic_hr_department_restriction/readme/CONTRIBUTORS.rst,sha256=A-ePkWzxL7sfk2futLXfYllbnSRrZzTeeJCNg_snLDo,86
13
13
  odoo/addons/analytic_hr_department_restriction/readme/DESCRIPTION.rst,sha256=_AIO2kymt1cEs5uL-oPiUw7Qs_bCuSSluW6QmWLOs3I,350
14
14
  odoo/addons/analytic_hr_department_restriction/readme/USAGE.rst,sha256=YBFF35tDh8dViMdrwn_p7TZ9WK1mHIX544mxR9cov0Q,582
15
15
  odoo/addons/analytic_hr_department_restriction/security/groups.xml,sha256=dN536AJfIOSRjUafmSvWpYGpqTV5no6DlLrh682yrug,423
16
16
  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=ObBcb4M4IojYHiSVzJvCpSWeLNrVi4MaNJU7XzNeMTE,14199
17
+ odoo/addons/analytic_hr_department_restriction/static/description/index.html,sha256=o0pv53gNxsI5NBEVPlwoxxao3Rat5EWdjmjP-nXV21g,14199
18
18
  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=12ZPEwm26Z116IhqHdvvHsEN1rNOjBT17u8inWA4QM0,5684
19
+ odoo/addons/analytic_hr_department_restriction/tests/test_analytic_hr_department_restriction.py,sha256=3rW0QarvaC1IoZYePJNyp6j5-h_rDrdZxkosM2RpPds,7305
20
20
  odoo/addons/analytic_hr_department_restriction/views/account_analytic_account_views.xml,sha256=IY6E8D5r5o4drFmOqaDq_tqnoFpzVSDT638AVUiq-98,1866
21
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.0.3.dist-info/METADATA,sha256=dL3EtaW5862EnvFQkJqUSwSIXdpAWNzI-b4K4tveBVM,4948
23
- odoo_addon_analytic_hr_department_restriction-16.0.1.0.0.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
24
- odoo_addon_analytic_hr_department_restriction-16.0.1.0.0.3.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
25
- odoo_addon_analytic_hr_department_restriction-16.0.1.0.0.3.dist-info/RECORD,,
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,,