Skip to Content
Menu
This question has been flagged

Hello Odoo community. How is it possible to hide the contacts that are not assigned to a salesperson? I tried to create a Record Rule and I have disabled others so that only their contacts can be seen.


- ['|', ('type', '!=', 'private'), ('type', '=', False), ('user_id', '=', user.id)] as Record Rule for Sales/User: Own Documents Only group in order to display only their contacts. 

- I use [(1,'=',1)] as Domain Filter for Sale /User: All Documents group so that administrators could see all contacts. 

- res.partner.rule.private.employee and res.partner.rule.private.group in order to hide all the contacts that are not of their own.

- I also had to assign to their Contact their own Salesperson so they could log into our system.


So... what is the problem? All users in the Sales/User: Own Documents Only group cannot see the Notes, Messages and Attachments in the Contacts assigned to them.


Could anybody help me with this? I'm using v14 Online.


Avatar
Discard
Best Answer



Hello Hassan Akil,

Please find below code it may help you to resolve this issue,
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)

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

Avatar
Discard
Related Posts Replies Views Activity
2
Nov 19
2249
2
Jan 24
1178
0
Jan 24
469
0
Nov 22
943
0
Dec 20
1051