Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
1232 Prikazi

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

Avatar
Opusti
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
Opusti

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)