Skip to Content

How to Restrict Access to Specific Records in Odoo

November 11, 2026 by

In most companies, not every employee should see all the data. A salesperson should work on their own quotations, a regional manager on their team's documents, and an accountant only on invoices assigned to a specific company. Odoo offers a powerful tool for this: Record Rules. In this article, we show how to restrict access to specific records, how to write a correct domain, and how to avoid common mistakes.

Want to see the features described here in action? Try Odoo for free and test record rules on your own data.

Try Odoo for free

Access Rights vs. Record Rules: What's the Difference?

Security in Odoo works in two layers, and it is worth understanding both.

Model Access Rights (Access Rights)

The first layer determines whether a user group can read, write, create, or delete records of a given model at all, for example sales orders or invoices. This works at the level of the whole table: either the group has access to the model or it doesn't. You can read more about how roles and permissions work in our complete guide to roles and access rights in Odoo.

Record Rules

The second layer works at the level of individual rows. A record rule contains a condition (a domain) that determines which records a user can see and which ones they can perform operations on. As a result, two users with the same model access right can see completely different sets of data. Rules only narrow down access within the model's access rights. They cannot grant permissions that the group doesn't have in the first place.

How to Enable Access to Record Rules

Record rules are part of the technical settings, so you first need to activate Developer Mode. You can enable it in Settings, in the Developer Tools section, or by adding the ?debug=1 parameter to the URL. Then go to:

  • Settings → Technical → Security → Record Rules.

You will see a list of all rules, including those provided by default by Odoo modules. Before changing existing rules, always analyze how they work, because many of them implement basic scenarios, such as data isolation between companies. Instead of modifying a standard rule, it is usually safer to add your own.

How to Restrict Access to Specific Records Step by Step

To restrict access to specific records, create a new rule and configure its fields.

1. Name and Model

In the Name field, enter a clear description, e.g. Sales Orders - own only. In the Object (Model) field, select the model the rule applies to, e.g. Sales Order (sale.order).

2. Domain

This is the heart of the rule. A domain is a condition written as a list of tuples. Examples:

  • Own documents only: [('user_id', '=', user.id)]
  • Own or unassigned: ['|', ('user_id', '=', user.id), ('user_id', '=', False)]
  • Documents of the user's team: [('team_id', '=', user.sale_team_id.id)]
  • Documents of selected companies (including records with no company assigned): ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]

In the domain, you can use context variables: user (the current user), company_id (the currently active company), company_ids (the list of companies selected in the company switcher), and time.

3. Groups

In the Groups field, specify which users the rule applies to. If you leave it empty, a global rule is created that applies to everyone. Well-planned groups make later management easier, so it is worth reading the guide on how to configure user groups in Odoo.

4. Scope of Operations

Using the checkboxes (read, write, create, delete), you decide which operations the rule applies to. An unchecked operation is not blocked by the rule; the rule simply doesn't cover it. For example, you can allow viewing all of a team's documents while limiting editing to your own only. Also remember that a rule with create or write checked also validates new and modified records. If the domain requires user_id = user.id, the user won't be able to save a document assigned to someone else.

Implementing advanced rules in a large organization requires careful planning. If you don't want to risk mistakes, consult your project with our specialists.

Contact us

Global and Group Rules: How Do They Combine?

This is the most common source of confusion. Odoo applies the following principles:

  • Global rules (without groups) are combined with the AND operator. A record must satisfy all of them.
  • Group rules are combined with the OR operator. It is enough for a record to satisfy one of the rules assigned to the user's groups.
  • The result of the group rules is then combined with the global rules using the AND operator.

In practice, this means that adding a new group rule usually widens access, while adding a global rule narrows it. If a user belongs to a group with the Own Documents rule and also to a group with the All Documents rule, they will see everything.

Practical Scenarios

A Salesperson Sees Only Their Own Quotations

In the standard Sales module, there are the access levels User: Own Documents Only and User: All Documents. Often it is enough to assign the appropriate access level, and you don't need to write your own rules. It is worth creating a custom rule only when the standard behavior doesn't cover your needs.

Data Isolation Between Companies

In a multi-company environment, a rule with a condition on company_id is crucial. Thanks to it, a user sees only the records of the companies they have access to. Standard Odoo modules already include it, but in custom models (e.g. your own modules) you have to add it yourself.

Access by Category or Tag

You can restrict the visibility of contacts, products, or projects based on a relational field, e.g. a tag, category, or department. You simply need to build an appropriate domain with the in operator, e.g. [('tag_ids', 'in', [tag_id])].

How to Test Record Rules

After saving the rule, check how it works from the perspective of a regular user:

  1. Create a test user with the appropriate permissions. We described how to do this in the article how to create new users in Odoo.
  2. Log in to that account or use the user impersonation feature, available in Developer Mode on the user form.
  3. Open the list view of the given model and check that only the expected records are visible.
  4. Try to edit and delete a record outside the scope to confirm that the operation is blocked.

Keep in mind that the Administrator account is also subject to record rules, but it usually belongs to many groups with broad access, and group rules are combined with the OR operator. That is why a test on the admin account can be misleading. Rules are bypassed completely only by the superuser (superuser mode in Developer Mode and sudo() calls in code).

Most Common Mistakes

  • An overly restrictive global rule - it applies to everyone and can block access even for people who should see the data.
  • Missing model access rights - a record rule won't grant anything if the group doesn't have the basic read right on the model.
  • An incorrect domain - a typo in a field name results in an error when opening views.
  • Ignoring empty values - records without an assigned user or company may become invisible to everyone.
  • Assuming rules always apply - code run with sudo(), custom integrations, or SQL queries bypass rules, so keep this in mind when building your own modules.
  • Editing without a backup - changes to rules affect the whole organization, so test them on a copy of the database first.

Best Practices

Apply the principle of least privilege: start with limited access and widen it as needed. Give rules clear names, document their purpose, and group permissions into roles that match job positions. When migrating or upgrading a database, check that custom rules still work correctly.

Want to safely practice configuring rules before rolling them out in your company? Create a free Odoo test database and check how the rules work on sample data.

Try Odoo for free

FAQ - Frequently Asked Questions

Do record rules apply to the administrator?

Yes. The Administrator account is subject to record rules, but it usually has many groups that widen access, so it often sees almost everything. Rules are bypassed only by the superuser (superuser mode and sudo() in code), so use a regular account with the appropriate permissions for testing.

What is the difference between a global rule and a group rule?

A global rule has no groups assigned and applies to all users, and multiple such rules are combined with an AND condition. Group rules apply to selected groups and are combined with an OR condition, so they usually widen access.

Can I restrict only editing and leave read access in place?

Yes. Each rule has separate checkboxes for read, write, create, and delete. You can therefore create one rule with a domain covering all of the team's records, applied to read only, and a second one that allows editing only your own records.

Summary

Record rules are the most effective way to restrict access to specific records in Odoo without creating separate databases or complicated workarounds. You just need to plan your groups well, write a precise domain, and test the solution thoroughly. Remember the difference between global and group rules, and your data will be safe and available only to the right people.

Need help implementing an access policy in Odoo? The KK Innovations team will gladly design and configure secure rules tailored to your company.

Contact us