access_restriction_by_user/README.md

49 lines
1.9 KiB
Markdown

# Access Restriction By User
This module allows administrators to restrict user access to specific records in Inventory, Manufacturing, and Approvals without using complex Record Rules.
## Features
Restrict visibility of the following records based on User configuration:
* **Warehouses** (`stock.warehouse`)
* **Picking Types** (`stock.picking.type`)
* **Locations** (`stock.location`)
* **Work Centers** (`mrp.workcenter`)
* **Approval Categories** (`approval.category`)
* **Quality Checks Button** (on Manufacturing Orders)
## Configuration
1. Navigate to **Settings > Users & Companies > Users**.
2. Select the user you want to restrict.
3. Go to the **Access Restrictions** tab.
4. Add records to the following fields:
* **Allowed Warehouses**
* **Allowed Picking Types**
* **Allowed Locations**
* **Allowed Work Centers**
* **Allowed Approvals**
## Important Usage Notes
* **Empty List = Unrestricted**: If an "Allowed" field is left empty for a user, they will have access to **ALL** records of that type.
* **Populated List = Restricted**: If one or more records are added, the user will **ONLY** see those specific records.
* **Superuser**: The Superuser (OdooBot) and administrators bypassing access rights are not affected by these restrictions.
## Quality Checks Button Restriction
The "Quality Checks" button on Manufacturing Orders is automatically hidden for users who belong to the following groups:
* **Inventory User**
* **Manufacturing User**
* **MPS User**
**Exception**: If a user in these groups is *also* assigned the **Quality User** or **Quality Manager** role, the button will remain visible.
## Technical Details
This module overrides the `_search` method on the target models to apply a domain filter based on the current user's allowed list. This ensures consistency across views (list, kanban, many2one dropdowns) and avoids common issues associated with Record Rules.
## Author
Suherdy Yacob