Skip to Content
Menu
This question has been flagged
1 Reply
872 Views

How to restrict visibility of customers & contacts for sales persons to only their own? in odoo 15 community edition

Avatar
Discard
Best Answer

Hello KOSMOS MANALU,

Please find below code it may help you to resolve this issue,

Please find code in comment. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard

class ResPartner(models.Model):
_inherit = "res.partner"

@api.model
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
if self.env.user.has_group('group_name_here'):
domain += [('user_id', '=', self.env.user.id)]
return super(ResPartner, self).search_read(domain=domain, fields=fields, offset=offset, limit=limit, order=order)