Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
2882 Widoki

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.


Awatar
Odrzuć
Najlepsza odpowiedź



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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lis 19
2912
2
sty 24
3357
0
sty 24
1604
0
lis 22
1880
0
gru 20
2153