Overview
Standard record rules do not always hide records from name searches or grouped views. This technical module provides a mixin that limits which records appear in searches, name lookups and grouped reads. Developers set a domain on a model and the limit is applied for non-administrators. It is used by other custom modules that need stricter visibility. It has no screens of its own.
Usage steps
- 1
Declare a limit domain
A model inherits the mixin and sets a limit domain string. The domain can use the current user, time and company values. It is validated before use.
- Attribute: _limit_domain
- Context: user, company_ids
- Invalid domain raises error
- 2
Limit name searches
When users type in a many2one selector, the name search adds the limit domain. Administrators are exempt. Other users see only allowed records in dropdowns.
- Applies to non-admins
- Dropdown results limited
- Name search override
- 3
Limit web searches and grouping
Searches marked with the limit context and grouped reads also add the domain. Web list views and pivots therefore respect it. Records fetched for display are read without re-applying the limit.
- Search override
- Grouped read override
- Fetch without re-limit
- 4
Carry the limit through actions
Window actions are extended so the limit context is passed to views. Menus opening a limited model automatically apply it. Developers do not need to repeat the setup.
- Model: ir.actions.act_window
- Context passed to views
- Automatic
Screens
Illustrative mockups with placeholder data.
Roles
| Role |
|---|
| Developer |
| Administrator |
Dependencies
Want to know more or try this app? Contact us
We can arrange a demo or a trial and answer your questions about Record Rules Base.
