Hi,
We are using Odoo 10 and I would like to create a record rule to limit access to quotations/sales orders and invoices to authorized persons only. To do so, I would like to filter data based on Sales Teams.
In other words, for quotations/sales orders, I would like to allow access to records for which at least one of these rules is true:
the current user is the salesperson on the sales order (equal to the user_id defined on sale.order)
the current user is part of sales teams set on the sales order (user_id in the members_id of the crm.team defined by team_id on sale.order)
the current user is the salesperson of the customer (user_id defined on the res.partner) set for the quotation or sales order (partner_id on sale.order)
For invoices, same thing but pointing on account.invoice objects.
I am not at ease with record rules and I would like not to break anything. Help would be much appreciated.