2 答案
Hi,
1. add custom field to Users Model:
Settings -> Technical -> fields , and add this information
1.1. first field (to restrict warehouse)
1.2. to restrict "location"
2. go to user form view add show added fields from previous step:
2.1. display first field
"Allowed warehouses", "allowed locations"
3. to give more dynamic manipulation create new group:
for example: restriction will just be applied to users who belong to specific group
4. add the following record rules by going to :
Settings -> Technical -> record rules
4.1. first one "to restrict wrehouses"
[('id','in',[w.id for w in user.x_warehouse_ids])]
4.2. second "to restrict picking type"
[('warehouse_id','in',[w.id for w in user.x_warehouse_ids])]
4.3. third "to restrict loction in reports" (optional):
[('location_id','in',[ws.id for ws in user.x_loc_ids])]
5. add warehouse user to "X group" which we created in step 3:
6. add warehouse to this user:
for example "warehouse 1" and locations for this warehouse
7. Test user dashboard will be:
Notes : he will only see operations for warehouse 1, i have created 3 warehouses, also he will only see products which are in specified allowed locations
Hope this will help.
This has to be done using record rules and access groups. Refer the Odoo documentation in the below link
https://www.odoo.com/documentation/15.0/developer/howtos/rdtraining/B_acl_irrules.html