Skip to content

[16.0][ADD] new module res_company_access_all_children#676

Merged
OCA-git-bot merged 2 commits intoOCA:16.0from
grap:16.0-ADD-res_company_access_all_childs
Jan 24, 2026
Merged

[16.0][ADD] new module res_company_access_all_children#676
OCA-git-bot merged 2 commits intoOCA:16.0from
grap:16.0-ADD-res_company_access_all_childs

Conversation

@legalsylvain
Copy link
Copy Markdown
Contributor

Description

This module is usefull in a multi-company context with hierarchy. (with parent and child companies)

Once installed, if a user has access to a parent company, he will have access to all the child companies.

If a new child company is created, all the users that have access to the parent company will have access to the new child company.

This module avoids the need for parameterization, which can be fastidious in a context with many companies and users.

@legalsylvain legalsylvain added this to the 16.0 milestone Aug 3, 2024
@legalsylvain legalsylvain force-pushed the 16.0-ADD-res_company_access_all_childs branch from 57b3201 to 7a28e9e Compare August 3, 2024 23:17
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 2, 2025

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 2, 2025
@github-actions github-actions Bot closed this Mar 9, 2025
@legalsylvain legalsylvain reopened this Mar 25, 2025
@polchampion
Copy link
Copy Markdown

@legalsylvain Great feature! I can test as soon as the runboat is built. I would only rename it in proper English res_company_access_all_children ;-)

@legalsylvain legalsylvain force-pushed the 16.0-ADD-res_company_access_all_childs branch from 17250de to 8e30efd Compare March 25, 2025 16:27
@legalsylvain legalsylvain changed the title [ADD] new module res_company_access_all_childs [ADD] new module res_company_access_all_children Mar 25, 2025
@legalsylvain
Copy link
Copy Markdown
Contributor Author

thanks for your english review !

module renamed.
runboat should be available in some minutes. please ping me if there is a problem.

@polchampion
Copy link
Copy Markdown

@legalsylvain I have this error when trying to set a company_id on a partner:

​​
code: 200
​​
columnNumber: 274
​​
data: Object { name: "odoo.exceptions.AccessError", debug: `Traceback (most recent call last):\n  File "/opt/odoo/odoo/http.py", line 1658, in _serve_db\n    return service_model.retrying(self._serve_ir_http, self.env)\n  File "/opt/odoo/odoo/service/model.py", line 152, in retrying\n    result = func()\n  File "/opt/odoo/odoo/http.py", line 1686, in _serve_ir_http\n    response = self.dispatcher.dispatch(rule.endpoint, args)\n  File "/opt/odoo/odoo/http.py", line 1890, in dispatch\n    result = self.request.registry['ir.http']._dispatch(endpoint)\n  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch\n    result = endpoint(**request.params)\n  File "/opt/odoo/odoo/http.py", line 734, in route_wrapper\n    result = endpoint(self, *args, **params_ok)\n  File "/opt/odoo/addons/web/controllers/dataset.py", line 43, in call_kw\n    return self._call_kw(model, method, args, kwargs)\n  File "/opt/odoo/addons/web/controllers/dataset.py", line 34, in _call_kw\n    return call_kw(Model, method, args, kwargs)\n  File "/opt/odoo/odoo/api.py", line 482, in call_kw\n    result = _call_kw_model_create(method, model, args, kwargs)\n  File "/opt/odoo/odoo/api.py", line 460, in _call_kw_model_create\n    result = method(recs, *args, **kwargs)\n  File "<decorator-gen-151>", line 2, in create\n  File "/opt/odoo/odoo/api.py", line 430, in _model_create_multi\n    return create(self, [arg])\n  File "/opt/odoo/addons/partner_autocomplete/models/res_partner.py", line 212, in create\n    partners = super(ResPartner, self).create(vals_list)\n  File "<decorator-gen-104>", line 2, in create\n  File "/opt/odoo/odoo/api.py", line 431, in _model_create_multi\n    return create(self, arg)\n  File "/opt/odoo/odoo/addons/base/models/res_partner.py", line 746, in create\n    partners = super(Partner, self).create(vals_list)\n  File "<decorator-gen-128>", line 2, in create\n  File "/opt/odoo/odoo/api.py", line 431, in _model_create_multi\n    return create(self, arg)\n  File "/opt/odoo/addons/mail/models/mail_thread.py", line 258, in create\n    threads = super(MailThread, self).create(vals_list)\n  File "<decorator-gen-68>", line 2, in create\n  File "/opt/odoo/odoo/api.py", line 431, in _model_create_multi\n    return create(self, arg)\n  File "/opt/odoo/odoo/addons/base/models/ir_fields.py", line 670, in create\n    recs = super().create(vals_list)\n  File "<decorator-gen-15>", line 2, in create\n  File "/opt/odoo/odoo/api.py", line 431, in _model_create_multi\n    return create(self, arg)\n  File "/opt/odoo/odoo/models.py", line 4019, in create\n    records = self._create(data_list)\n  File "/opt/odoo/odoo/models.py", line 4272, in _create\n    records.check_access_rule('create')\n  File "/opt/odoo/odoo/models.py", line 3536, in check_access_rule\n    raise self.env['ir.rule']._make_access_error(operation, forbidden)\nodoo.exceptions.AccessError: Due to security restrictions, you are not allowed to create 'Contact' (res.partner) records.\n\nContact your administrator to request access if necessary.\n`, message: "Due to security restrictions, you are not allowed to create 'Contact' (res.partner) records.\n\nContact your administrator to request access if necessary.", … }
​​
exceptionName: "odoo.exceptions.AccessError"
​​
fileName: "http://oca-multi-company-16-0-pr676-8e30efda9ad1.runboat.odoo-community.org/web/assets/216-4cd1e31/web.assets_backend.min.js"
​​
lineNumber: 998```

@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 30, 2025
@legalsylvain
Copy link
Copy Markdown
Contributor Author

hi @polchampion.

This error looks legit and occures in native Odoo instance.

Copy link
Copy Markdown
Contributor

@quentinDupont quentinDupont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with success on runboat ✔️

@quentinDupont
Copy link
Copy Markdown
Contributor

Hey @polchampion could review it again ? :)

@LoisRForgeFlow LoisRForgeFlow changed the title [ADD] new module res_company_access_all_children [16.0][ADD] new module res_company_access_all_children Aug 21, 2025
…r to all child companies,

when a user has access to parent company
…mpany_id' that makes classic module failing, like 'res_company_access_all_childs'
@legalsylvain legalsylvain force-pushed the 16.0-ADD-res_company_access_all_childs branch from 8e30efd to cebca51 Compare November 17, 2025 10:15
@legalsylvain
Copy link
Copy Markdown
Contributor Author

/ocabot merge nobump

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-676-by-legalsylvain-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Jan 23, 2026
Signed-off-by legalsylvain
@OCA-git-bot
Copy link
Copy Markdown
Contributor

@legalsylvain The merge process could not be finalized, because command twine upload --disable-progress-bar --non-interactive --repository-url https://upload.pypi.org/legacy/ -u __token__ odoo_addon_res_company_access_all_children-16.0.1.0.0.2-py3-none-any.whl failed with output:

Uploading distributions to https://upload.pypi.org/legacy/
Uploading 
odoo_addon_res_company_access_all_children-16.0.1.0.0.2-py3-none-any.whl
�[33mWARNING �[0m Received "502: Bad Gateway"                                            
         Package upload appears to have failed. Retry 1 of 5.                   
Uploading 
odoo_addon_res_company_access_all_children-16.0.1.0.0.2-py3-none-any.whl
�[33mWARNING �[0m Received "502: Bad Gateway"                                            
         Package upload appears to have failed. Retry 2 of 5.                   
Uploading 
odoo_addon_res_company_access_all_children-16.0.1.0.0.2-py3-none-any.whl
�[33mWARNING �[0m Received "502: Bad Gateway"                                            
         Package upload appears to have failed. Retry 3 of 5.                   
Uploading 
odoo_addon_res_company_access_all_children-16.0.1.0.0.2-py3-none-any.whl
�[33mWARNING �[0m Received "502: Bad Gateway"                                            
         Package upload appears to have failed. Retry 4 of 5.                   
Uploading 
odoo_addon_res_company_access_all_children-16.0.1.0.0.2-py3-none-any.whl
�[33mWARNING �[0m Received "502: Bad Gateway"                                            
         Package upload appears to have failed. Retry 5 of 5.                   
�[33mWARNING �[0m Error during upload. Retry with the --verbose option for more details. 
�[31mERROR   �[0m HTTPError: 502 Bad Gateway from https://upload.pypi.org/legacy/        
         Bad Gateway                                                            

@legalsylvain
Copy link
Copy Markdown
Contributor Author

/ocabot merge nobump

@OCA-git-bot
Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-676-by-legalsylvain-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit a438ad3 into OCA:16.0 Jan 24, 2026
7 of 8 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 67b96d6. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants