Home › Curriculum › Odoo Developer › Record rules, multi-company rules and Odoo 20 changes
Security · 16 min · 17–20Record rules, multi-company rules and Odoo 20 changes
Row-level security with ir.rule, global vs group rules, multi-company isolation, and what Odoo 20 changed.
In this lesson
- ir.rule: domains, global vs group, combination
- Multi-company rules and check_company
- Odoo 20 changes and testing
Key points
- domain_force per user, with perm_read/write/create/unlink
- Global rules AND; group rules OR among themselves, then AND globals
- [('company_id','in',company_ids)] + check_company/_check_company_auto
- Odoo 20: domains on access rights replace separate record rules; review custom security
Real-world example
Salespeople at a two-company group could see the other company's quotations after a consultant created a new sales model without a company rule. Adding a multi-company global rule and check_company on its Many2ones fixed visibility; on the Odoo 20 upgrade the same restriction moved to the access right's domain.
Questions and answers
What does [(1,'=',1)] mean in a rule?
Always true: no restriction for that group.
What does check_company=True on a Many2one do?
Prevents linking records from incompatible companies.