[19.0][ADD] res_company_admin_sync: keep system administrators assigned to every company#1025
Open
mikecolangelo wants to merge 1 commit into
Open
Conversation
…every company In a multi-company database, nothing keeps administrators' company assignments in sync with the companies that exist: a company created after the administrator misses from their company_ids (so it never shows in their company switcher), and a user promoted to administrator keeps whatever partial assignment they had. Audited on a real ~270-company production database: every administrator had accumulated gaps, up to 31 active companies missing each, including the most recently created ones. Grant automatically instead: creating a company adds it to every base.group_system user's companies, and granting base.group_system adds every existing company to the new administrator. Deliberately one-way (it never revokes): removing companies on demotion could silently strip access the user still legitimately needs, so trimming is left as an explicit administrative action.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New module:
res_company_admin_syncIn a multi-company database, nothing keeps administrators' company assignments in sync with the companies that exist:
company_ids, so it never shows up in their company switcher;We audited a real ~270-company production database: every single administrator had accumulated gaps — up to 31 active companies missing each, including the most recently created ones. The administrators technically retained access through
base.group_erp_managerexemptions, but the company switcher (which only listscompany_ids) made those companies effectively unreachable in the UI.This module grants automatically instead:
base.group_systemuser's companies;base.group_systemadds every existing company to the new administrator.Deliberately one-way (it never revokes): removing companies on demotion could silently strip access the user still legitimately needs, so trimming is left as an explicit administrative action.
Only depends on
base. 4 tests, green on a fresh vanilla Odoo 19 install with only this module.