Enable User Roles depending on the Companies selected.
A company specific Role will only be enabled if it is set for all the currently selected companies.
For example, if a user is "Sales Manager" only for Company A, it will see that role enabled only if Company A is selected. If the user selects Company A and Company B, then the "Sales Manager" role won't be enabled.
auto_awesome What this module does
AI-generated from the code · Odoo 19.0Lets you assign a user role to a specific company, so a role only becomes active when the right company (or companies) are selected. Adds a Company field on each role line in the user form.
This module extends the user roles feature so that a role can be tied to a company. On the user form, in the list of role lines, a new Company field appears (visible when the multi-company setting is on). If you leave it empty, the role applies to all companies; if you set it, the role only applies when that company is among the currently selected companies.
Business rules added by the code: - A role is enabled only when it applies to all currently selected companies. For example, a role set for Company A is active when only Company A is selected, but not when Company A and Company B are both selected. - You cannot assign a role to a company the user does not have access to; Odoo raises a validation error in that case. - The same role can be assigned several times to the same user, as long as each line is for a different company (uniqueness is enforced on user, role and company together).
The module recalculates the user's groups when the session starts, when the user logs in, and when the selected companies change, so the menus and access rights follow the active company selection. It touches res.users, res.users.role.line and the web session handling.
Depends on
Models and fields (3)
- ir.http · extends an existing model
- res.users · extends an existing model
- res.users.role.line · extends an existing modelcompany_id, allowed_company_ids
Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub
Availability by version
Reviewed: 2026-11-03Confirmation status: 6 confirmed, 3 with no information of 9 versions.
Sources · Odoo 14.0
Confirmed on 2026-11-03 in branch 14.0 of OCA/server-backend.
terminal Installation and usage
OCA documentation · Odoo 19.0Configuration
Source · Odoo 19.0Roles are set on the User form.
The "Company" additional column allows to set a Role as only valid for specific companies.
There is also a "Active Role" techincal field, only visible in developer mode. It shows what roles are active, after applying the company selection rules.
Usage
Source · Odoo 19.0Select the active companies from the web client widget, near the top right corner. When doing so, the User's security Groups are recomputed, based on the Roles.
When the user changes the company selection, only the groups available to all active companies will be activated.
For example:
- A "SALES PERSON" and a "SALES MANAGER" roles are created.
- A user is assigned to the roles:
- "SALES PERSON", with no specific company assigned (meaning all)
- "SALES MANAGER" only to "My Company (Chicago)"
- When selecting active companies from the UI widget:
- If only "My Company (San Francisco)" is active, "SALES PERSON" will be active.
- If only "My Company (Chicago)" is active, "SALES PERSON" and "SALES MANAGER" will be active.
- If both "My Company (San Francisco)" and "My Company (Chicago)" is active, "SALES PERSON" will be active.
No verified information in OCA: Installation.
Installation instructions, the distribution package, dependencies and configuration steps are not shown because they have not yet been verified in the module documentation for any version.
Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.