Blog
Odoo Access Rights and Record Rules: Designing Roles That Do Not Break
How Odoo access rights, record rules and groups combine, and a practical way to design roles that stay secure and do not lock your team out as you grow.
- mid
- odoo
Odoo security is built from three layers: groups, access rights and record rules. Most role problems come from mixing them up. Access rights decide which models a user can touch at all. Record rules decide which records within those models they can see. Groups are the container that ties both to people.
The short answer for designing roles that do not break: define roles as groups first, grant model access only through groups, use record rules sparingly and mostly as group rules, and test every role with a real user before go-live.
The three layers, in plain terms
Groups. A user belongs to groups, and security attaches to those groups. According to Odoo’s developer documentation, a group can imply other groups through implied_ids, so a manager group can automatically include the user group beneath it.
Access rights (ir.model.access). These grant create, read, write and delete permissions on an entire model. All four are off by default, and access is additive: a user gets the union of what all their groups allow. Two details matter:
- If no access right matches an operation, the user has no access to it.
- An access right with an empty group applies to every user, including portal and public users. That is rarely what you want.
Record rules (ir.rule). These are conditions checked record by record, applied after access rights. They are default-allow: if access rights permit an operation and no rule applies, the operation succeeds. A rule carries a domain_force expression, a list of groups, and flags for which operations (read, write, create, delete) it covers.
How rules combine: where roles usually break
The official documentation is explicit about combination logic, and this is where most surprises come from:
| Rule type | Definition | How multiple rules combine |
|---|---|---|
| Global rule | No groups assigned | Intersect: every applicable global rule must pass |
| Group rule | One or more groups assigned | Union: passing any one applicable group rule is enough |
| Global and group sets together | Both exist | Intersect: group rules can widen access, but never beyond what global rules allow |
Two consequences follow.
First, every global rule you add only narrows access. Stack a few and they can end up non-overlapping, which removes access for everyone. The documentation itself warns that creating multiple global rules is risky.
Second, adding the first group rule to a model that previously had none changes behavior. Because rules are default-allow, a model with no rules is open to anyone with access rights. Once you add one group rule, users outside that group can fall into the restricted set. This is a common cause of “it worked yesterday, now Sales cannot see anything” tickets.
A role design process that holds up
Skip the model-by-model spreadsheet at the start. Work from jobs.
- List roles by job, not by person. For example: Sales rep, Sales manager, Warehouse operator, Accountant, Purchasing, Read-only auditor. Aim for fewer than ten to start. Every extra role is one more thing to test after each upgrade.
- Start from standard groups. Odoo apps ship with their own groups, shown on the user form as choices such as own documents, all documents or administrator (Odoo access rights docs). Map your roles to those first. Custom groups are for real gaps.
- Use inheritance. Build manager groups on top of user groups through implied groups so you maintain permissions once.
- Prefer group rules over global rules. Group rules are additive and easier to reason about. Reserve global rules for a hard boundary that must apply to everyone, such as company separation.
- Keep domains simple. A rule like “own records only” or “records of my team” is easy to explain and audit. Long nested domains are where bugs hide.
- Restrict fields separately. For sensitive values such as cost, margin or salary, use a field-level
groupsattribute. Users outside the group lose the field from views andfields_get(), and explicit reads or writes raise an access error (Odoo documentation). It is often cleaner than trying to hide data with record rules.
Multi-company and the company variables
Record rule domains can use variables such as user, company_id and company_ids, per the documentation. Multi-company setups lean on these heavily, and they are the typical place where a custom rule interacts badly with a standard one. If you run several legal entities, test with a user who belongs to only one company and another who belongs to several.
Custom code: access checks are not automatic everywhere
If you build custom modules, the same documentation lists pitfalls worth knowing:
- Access checks happen on CRUD operations. Public methods can be called over RPC with arbitrary arguments, so validate inputs.
- Making a method private (prefixed with
_) keeps it off the external API, but the public method that calls it must still check the record and parameters. - Raw SQL bypasses access rights, translations and the
activefilter. Use ORM methods such assearchinstead.
A minimal access line in ir.model.access.csv looks like this:
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_x_job_user,x.job user,model_x_job,base.group_user,1,1,1,0
Notice the group is set explicitly. Leaving it empty exposes the model to everyone, including portal and public users.
Testing and operations
Security work fails quietly, so build testing into the process:
- Test as real users. Create a test user per role and walk through the real workflow: quote, order, delivery, invoice. Do not test as an administrator.
- Avoid superuser mode as a shortcut. Odoo’s documentation notes that superuser mode bypasses record rules and access rights, and that users may be locked out of the database when they exit it.
- Protect your own admin access. Odoo’s documentation warns about an “impotent admin” state, where no user in the database can change access rights. Keep at least two trusted administrators.
- Re-test after upgrades and new modules. Installing an app can add groups and rules. Add a security regression check to every release.
- Review quarterly. People change jobs. Remove access when roles change, not only when people leave.
- Use a staging copy. Odoo’s documentation advises testing changed settings to confirm they apply to the right users and contacting Odoo support or a business analyst before changing access rights. A staging copy is the safest place to do that testing.
Common mistakes to avoid
- One “super user” role that everyone ends up using because the real roles never got finished.
- Global rules added for convenience that later conflict with each other.
- Access rights with an empty group on custom models.
- Hiding data with views alone. Hidden in the interface is not the same as protected in the system.
- No documented role matrix, so nobody knows why a user can see something.
What this means for your project
Role design is a short workshop, not a large project, if you do it before configuration starts. Write down roles, the records each one should see, and the fields that need protection. Then implement with standard groups where possible and a small number of group rules. The cost of doing it late is real: retrofitting security onto live data usually means re-testing every workflow.
If you want a second opinion on a role matrix or a security review of a custom module, Teknologia Solutions is happy to have a no-charge conversation. No pitch required, and you are free to take the notes back to your own team.
Sources: Odoo 18 developer documentation, Security in Odoo; Odoo 18 documentation, Access rights. Behavior can differ between Odoo versions and editions, so verify details against the primary documentation for your version before changing production security.