Technical

Odoo Access Rights Explained: Groups, ACLs, Record Rules

How Odoo decides who can see and change what: groups, access control lists, record rules and multi-company rules, plus a practical way to give each team only the access it needs.

Kalvyai Engineering · · 8 min read

Odoo Access Rights Explained: Groups, ACLs, Record Rules (cover)
On this page

Most Odoo access problems look the same from the outside. A salesperson sees margins they should not see. A warehouse user cannot validate a transfer. An accountant in one company can open invoices from another. Each of these comes from one of four layers: groups, access control lists, record rules or multi-company rules.

This post explains each layer, how they combine, and how to design roles so each team gets only what it needs.

The four layers at a glance

Odoo checks access in this order when a user touches data:

  1. Groups decide who the user is, in security terms.
  2. Access control lists (ACLs) decide which models the user can read, write, create or delete.
  3. Record rules decide which records of those models the user can touch.
  4. Field-level groups decide which fields on those records the user can see.

Multi-company rules are record rules with a company filter, so they sit in layer 3.

There is also a fifth thing people confuse with security: hiding menus, buttons and views with a groups attribute. That changes the interface. It does not stop a user from reaching the data another way, for example through a related field, an export, a URL or the API. Treat UI hiding as convenience, and treat ACLs and record rules as the actual security.

Groups

A group (res.groups) is a named set of permissions. Users belong to groups. ACLs, record rules, menus, views and fields point at groups.

The standard apps ship their own groups, usually in levels. Sales, for example, has a user level that sees only its own documents, a level that sees all documents, and an administrator level.

Two things matter most about groups:

  • Implied groups. A group can imply other groups through implied_ids. If "Sales Administrator" implies "All Documents", every sales administrator also gets everything "All Documents" grants. This is how levels stack.
  • Groups only add. There is no "deny" group. Adding a user to another group can only give them more access, never less. To restrict someone, you remove groups or narrow what those groups grant.

You can see groups under Settings in developer mode. How groups are categorised and shown on the user form has changed between versions, so check how your version displays custom groups before you design around it.

Access control lists (ACLs)

ACLs (ir.model.access) work per model. Each line says: members of this group get these four permissions on this model.

  • perm_read
  • perm_write
  • perm_create
  • perm_unlink (delete)

ACLs are additive. If any of the user's groups grants read on a model, the user can read that model. An ACL line with no group applies to every user, so use that carefully.

If a user has no ACL granting access to a model, they get an access error, no matter what record rules say. Record rules can only narrow access that an ACL already gave.

In a custom module, ACLs usually live in security/ir.model.access.csv:

Plain text
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_field_visit_user,field.visit user,model_field_visit,group_field_visit_user,1,1,1,0
access_field_visit_manager,field.visit manager,model_field_visit,group_field_visit_manager,1,1,1,1

Here, field users can read, edit and create visits but cannot delete them. Managers can also delete.

One common mistake: adding a new model in a module and forgetting the CSV line. Since Odoo 14, a model with no ACL at all shows a warning in the log and is not accessible to normal users.

Record rules

Record rules (ir.rule) filter records with a domain. If a record does not match the domain, the user cannot see or change it, depending on which operations the rule applies to.

Each rule has:

  • a model
  • a domain (domain_force)
  • a list of groups, or no groups
  • flags for read, write, create and unlink

The domain is evaluated with some variables available, including user (the current user record), company_ids (the companies the user has active in the company switcher) and company_id (the current company).

How rules combine

This is the part that causes the most confusion:

  • Global rules (no groups) apply to everyone and are combined with AND. Every global rule must match.
  • Group rules apply to members of those groups and are combined with OR. A record that matches any one of the user's group rules passes.
  • The result of the group rules is then combined with the global rules using AND.

The practical effect: a group rule cannot restrict a user who also has a broader group. If a user is in "Own Documents Only" and also in "All Documents", the "All Documents" rule wins, because group rules are OR'ed. When a restriction is not working, check every group the user has, including implied ones.

Example: team leads see their team's orders

Say you want a middle level in Sales. Salespeople see their own orders. Managers see everything. Team leads should see their own orders and every order of a sales team they lead.

In a custom module:

XML
<odoo>
    <record id="group_sale_team_lead" model="res.groups">
        <field name="name">Sales: Team Lead</field>
        <field name="implied_ids" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
    </record>

    <record id="sale_order_rule_team_lead" model="ir.rule">
        <field name="name">Sales Order: team leads see their teams</field>
        <field name="model_id" ref="sale.model_sale_order"/>
        <field name="domain_force">[
            '|',
            ('user_id', '=', user.id),
            ('team_id.user_id', '=', user.id)
        ]</field>
        <field name="groups" eval="[(4, ref('group_sale_team_lead'))]"/>
        <field name="perm_read" eval="True"/>
        <field name="perm_write" eval="True"/>
        <field name="perm_create" eval="True"/>
        <field name="perm_unlink" eval="False"/>
    </record>
</odoo>

What this does:

  • The new group implies the standard "own documents" sales group, so team leads keep the normal salesperson access.
  • The rule lets them also see orders where the order's sales team has them as team leader (team_id.user_id).
  • Because the salesperson group's own rule and this rule are both group rules, they are OR'ed. The lead sees their own orders plus their teams' orders.
  • perm_unlink is False, so this rule does not apply to delete. Delete is still governed by the ACLs and any other rules.

Before deploying, confirm the group XML IDs and field names, such as team_id.user_id, against your Odoo version. Also apply the same idea to quotations' related records if leads need them, such as invoices or delivery orders, because a rule on sale.order does not cover other models.

Multi-company rules

In a multi-company database, most business models have a company_id field and a global record rule like this:

Python
['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]

Records with no company are shared. Records with a company are visible only when that company is active for the user.

Three points to keep in mind:

  1. Allowed companies vs active companies. On the user form you set which companies a user is allowed to access. In the company switcher, the user picks which of those are active right now. company_ids in rules refers to the active ones.
  2. Custom models need their own rule. If you add a company_id field to a custom model, Odoo does not add the multi-company rule for you. Write it yourself, as a global rule.
  3. Cross-company links. A sales order in company A should not point to a warehouse in company B. Odoo can check this on save if the model sets _check_company_auto = True and the relational fields use check_company=True. Use this on custom models that carry a company.

A global rule for a custom model:

XML
<record id="field_visit_company_rule" model="ir.rule">
    <field name="name">Field Visit: multi-company</field>
    <field name="model_id" ref="model_field_visit"/>
    <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>

No groups field means it is global, so it applies to every user and is AND'ed with everything else.

Field-level access

You can restrict a single field by adding groups to its definition in Python:

Python
margin = fields.Float(groups="sales_team.group_sale_manager")

Users outside that group do not get the field at all, in views, exports or the API. This is stronger than hiding the field in a view, which only removes it from that one screen.

Code that bypasses security

Server code can skip these checks. sudo() runs as the superuser and ignores ACLs and record rules. Automated actions, scheduled actions and some integrations run with elevated rights too.

This is fine when deliberate, but it is where data leaks often start. When you review a custom module, search for sudo() and ask, for each one, whether the result is returned to a user who should not see it. The same applies to AI agents and connectors that read or write Odoo data: they should run as a dedicated user with its own limited groups, not as the administrator.

How to give each team only what it needs

A method that works on most projects:

  1. List the roles, not the people. For example: Sales Rep, Sales Team Lead, Warehouse Operator, Purchase Officer, Accountant, Company Admin.
  2. Build a role matrix. For each role, write which models they need and which of read, write, create and delete. Then write which records: their own, their team's, their warehouse's, their company's, or all.
  3. Start from the standard groups. Assign the closest standard levels first. Most needs are already covered.
  4. Add custom groups only for real gaps. Create one custom group per gap, with an implied standard group as its base, like the team lead example above.
  5. Write record rules for the "which records" column. Keep domains short and use fields that already exist.
  6. Check implied groups. For every role, expand the full list of groups it ends up with. Look for a broad group that cancels a narrow rule.
  7. Test as each role. Create a test user per role, log in as that user and try the main flows: create, edit, confirm, print, export. In automated tests, use with_user() to run code as a specific user.
  8. Document it. Keep the role matrix next to the module so the next admin knows why each rule exists.

Common pitfalls

  • Giving users the Settings or administrator group "just for one thing".
  • Restricting access only by hiding menus.
  • Adding a restrictive group rule and wondering why it has no effect (another group rule is OR'ing it away).
  • Forgetting related models: restricting sale.order but not the invoices or deliveries created from it.
  • Record rule domains that traverse many relations, which can slow down every list view on that model. Keep them simple and test performance with real data volumes.

When the standard tools are not enough

ACLs and record rules cover the data. Many teams also want finer control over the interface: hiding specific menus, buttons, tabs or reports per user, or making a user read-only. Our Access Management Pro app lets admins hide menus, buttons, tabs, fields, reports and actions, set read-only users and manage record rules from one place, without writing a module for each change.

How Kalvyai can help

We design and implement Odoo access setups for single and multi-company databases: role matrices, custom groups, record rules, security reviews of custom modules, and dedicated restricted users for integrations and AI agents. See our Odoo services, browse our apps at store.kalvyai.com, or contact us to review your current access rights.

Share this article

  • Odoo
  • Access Rights
  • Record Rules
  • Security
  • Multi-Company
  • ERP Administration

Kalvyai Engineering · Engineering team

The engineers who build, connect and fix business systems at Kalvyai: Odoo, ERPNext, Shopify and AI agents that work inside them with approvals, budgets and an audit trail.

Comments

No comments yet. Questions and corrections are welcome.

Rate this post or leave a comment

Your rating (optional)
Not rated

Comments appear after an editor approves them. See our privacy notice.

Read next

WhatsApp Coexistence for Odoo 19: Setup and User Guide (cover)User guide
Kalvyai EngineeringOdoo

WhatsApp Coexistence for Odoo 19: Setup and User Guide

How to install, connect and use WhatsApp Coexistence for Odoo 19 so your team keeps replying from the WhatsApp Business app while Odoo logs every message on the same number.

7 min read

Newsletter

Get new guides in your inbox.

Practical notes on Odoo, ERPNext, Shopify and AI agents, written by the engineers who build them. No spam, and you can ask to stop at any time.

Prefer a feed? Subscribe by RSS. We use your email only to send new articles. See our privacy policy.