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
2952 Widoki

Is this possible to do this by record rule?

Example:

user A have saleteam with member B,C,D. A is the leader of this team.

so if we login to A, and go to account.move, we can see records of A,B,C,D.

if we login to b, we only see B records.

Thanks you.

Note: Other solution are good too, no need to be record rule.

Awatar
Odrzuć
Najlepsza odpowiedź

Hello fudo,

You can achieve this by using search_read method,

Find Code in comment. 

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

Awatar
Odrzuć

Create one group for Leader and try below code,

def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
teams = self.env['crm.team'].search([('user_id', '=', self.env.user.id)]).mapped('member_ids')
if self.env.user.has_group('account.group_account_manager') and self.env.user.has_group('new grop for leader'):
domain += ['|', ('invoice_user_id', 'in', teams.ids), ('invoice_user_id', '=', self.env.user.id)]
else:
domain += []
return super(AccountMove, self).search_read(domain=domain, fields=fields, offset=offset, limit=limit, order=order)

Autor

thanks you for reply, i'll try this and response to you as soon as posible.

Autor

thanks you sir, this solution was great, i was never know about search_read function before, this function can be use like record rule, even better.

Powiązane posty Odpowiedzi Widoki Czynność
2
sie 25
2333
2
cze 23
3495
2
wrz 22
4079
1
sie 23
2932
1
lip 23
3139