Odoo 15 to 17:
created a custom module,
- inherit and added a field 'supervisor' in res.users
- inherit and added above field in user's form view
so, when add/edit a user, we can select another user as his Supervisor (like Manager in Employee)
requirement:
- in Contacts to create, write, delete a Supervisor can access his and all subordinates data only
- a User can see his data only
for CRM, i used below filter in Record Rule which is working fine now (please if possible, kindly advice if it has any mistake or if there is something to improve)
['|', '|', ('user_id', '=', user.id), ('user_id', '=', False), ('user_id.user_ids.supervisor', '=', user.id)]
i tried it in Contact but it is showing all records to any logged-in user. please correct me to write a valid domain filter for Contact.
regards