Search code examples
odooodoo-8odoo-9odoo-view

Restrict partner to display in odoo


I want to add record level restriction in odoo. I want display just that partners to current login user which state_id equals to state_id of current login user.


Solution

  • For that you have to add Record Rule from Settings/Technical/Security/Record Rules menu. In that you have to set object as Partner (res.partner). Need to set Rule Definition(Domain Filter) like below code and just save it.

    [('state_id','=',user.partner_id.state_id.id)]