In most companies, not every employee should see all the data. A salesperson doesn't need to know a product's margin, and a warehouse worker shouldn't see salary rates. Odoo lets you solve this at the level of individual fields. In this article, we show how to configure field access rights (field-level security) in Odoo 19 and how to do it safely.
Want to try the settings described here in practice? Create a free Odoo instance and test them on your own data before rolling out changes in your company.
What is field-level security in Odoo?
Field-level security is a mechanism for restricting access to a specific field in a model, for example the purchase price, margin, bank account number, or internal notes. Access to the field is granted to selected user groups. When a field is protected at the model level, other users won't see it in forms, lists, filters, or exports, and any attempt to read or write it will result in an access error.
It's worth distinguishing this mechanism from the other security layers in Odoo:
- Model access rights (ir.model.access) define whether a group can read, edit, create, or delete records of a given model.
- Record rules determine which records (rows) a user can see.
- Field access rights determine which data columns are available in the records a user can already see.
Only the combination of all three layers gives you a consistent security model.
Preparation: access groups
Field access rights are based on groups. Before you start, make sure you have a group that should be able to see the given field. It can be a standard Odoo group (e.g., an app's Administrator group or the Administration: Settings group) or a custom group created for a specific process. We describe how to do this in our guide on how to create custom access groups in Odoo.
It's also useful to enable developer mode (Settings → Activate the developer mode), because some technical options are only available there. You refer to a group by its external identifier (XML ID), e.g., sales_team.group_sale_manager. In developer mode, you can find it under Settings → Technical → Security → Groups or in External Identifiers.
Method 1: restricting a field in a view
The simplest way is to add the groups attribute to a field in the XML view definition. The field will then be visible only to the specified groups:
<field name='margin_note' groups='sales_team.group_sale_manager'/>
You can specify several groups separated by commas. You can also exclude a group by prefixing its identifier with an exclamation mark, e.g., groups='base.group_user,!base.group_portal'. You can modify the view through an inherited view (in developer mode: Settings → Technical → User Interface → Views) or in your own module.
Limitations of this method
The groups attribute in a view hides the field only in that specific view. If the same field appears in other views, in lists, or in reports, or is available through the API, the user may still be able to access it. That's why for sensitive data it's worth using the second method.
Method 2: restricting a field in the model
The most reliable protection is to assign groups directly to the field in the model definition:
margin_note = fields.Char(string='Margin note', groups='sales_team.group_sale_manager')
As a result, the server itself blocks access to the field for users outside the specified group. The field is automatically removed from views, and any attempt to read or write it (including through export, search, or external RPC/API calls) results in an access error. A user without permission can neither read nor write such a value.
You can do the same for a standard field by extending the model in your own module (_inherit) and redefining the field with the groups attribute. Keep in mind that standard views, automations, and Odoo code may also reference such a field in the context of users outside the group, so always test this kind of change thoroughly.
Custom fields created from the interface
For manual fields (with the x_ prefix), you can assign groups without any coding. In developer mode, go to Settings → Technical → Database Structure → Models, open the relevant model, and select the field. In the field definition, you can specify the groups that are granted access.
If you use Odoo Studio (Enterprise version), you can also assign groups while editing a view. Select the field and, in its properties, specify the groups for which it should be visible. Keep in mind, however, that this setting applies to a specific view and doesn't replace protection at the model level. For sensitive data, additionally set groups in the field definition.
See how it works in practice before you roll out changes to production. The safest way is to do it on a free test instance.
Method 3: read-only fields and conditional visibility
Sometimes a user should see a field but not be able to edit it. In such cases, you use the readonly and invisible attributes with expressions that depend on the values of other fields, for example the document status (e.g., readonly='state != "draft"'). In newer versions of Odoo, including Odoo 19, they are written directly as expressions, without the former attrs attribute. This is not group-based protection but interface logic, which can be bypassed, for example, through the API. It's worth combining it with the groups attribute and model access rights to precisely control who can change data and when. A similar approach is used when locking approved documents, which we describe in our article on how to lock editing of posted documents in Odoo.
How to test the configuration?
- Create a test user with the permissions that the target users are meant to have.
- Log in to that account (or use the option to log in as a selected user available in developer mode) and open the form and list containing the field.
- Check data export, filters, grouping, and search. The field should not be available.
- Check the reports and print templates that may reference this field.
- If you use integrations or the API, check that the technical account doesn't lose access to the fields it needs.
If your reports have different access levels, also take a look at our article on how to configure access rights to reports in Odoo.
Best practices
- Principle of least privilege. Grant access to a field only to the groups that actually need it.
- Use groups, not individual users. This way, when an employee changes roles, you only need to change their groups.
- Protect at the model level. For sensitive data, don't stop at hiding the field in a view.
- Watch out for computed and related fields. If the value of a sensitive field is copied or computed into another field, protect that field as well. Remember that related fields read data with superuser privileges by default (related_sudo), which may expose the value.
- Document your changes. Record which fields are restricted and for whom, to make audits and updates easier.
- Test after updates. After a migration or installing new modules, check that the restrictions still work.
For a broader look at access control, see our guide on how to restrict access to modules in Odoo.
Most common mistakes
Typical problems include hiding a field in only one view, providing an incorrect group identifier (which may prevent the view or model from loading), and overlooking list, kanban, and report views where the field still appears. It also happens that restricting a field causes errors in automations, server actions, or computed fields triggered by a user without access. In that case, you need to analyze the business logic, and sometimes use sudo() in the code. This should be done carefully so as not to bypass the protection you've just introduced.
For complex permission structures, it's worth getting help from experienced consultants who will design the configuration without risk to business continuity. Contact us and we'll analyze your needs.
FAQ: frequently asked questions
Can field access rights be set up without coding?
Yes, for custom fields. You can assign groups in developer mode in the field definition (Settings → Technical → Database Structure → Models) or in Odoo Studio. For standard Odoo fields, the most reliable approach is to extend the model in your own module.
Is hiding a field in a view enough to protect data?
Not always. The groups attribute in a view hides the field only in that view. To block access in exports, search, and through the API as well, assign groups to the field in the model definition.
How do field access rights differ from record rules?
Record rules restrict which records (rows) a user can see, for example only their own orders. Field access rights restrict which information (columns) is available in the visible records. It's best to use them together.
Summary
Configuring field access rights in Odoo is an effective way to protect sensitive data without limiting your team's work. Start with well-designed groups, protect fields at the model level, and use views to fine-tune the interface. If you also assign permissions while employees are away, see how delegation of permissions works in Odoo.
Need help implementing a secure permissions structure in your company? The KK Innovations team will be happy to advise you and configure a system tailored to your processes.