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

I have a domain in window action. I want to filter the data by this domain, and I need to acccees another field of currently logged user some like this (uid.branch_ids.ids) and use this field in the domain. I don't know how to do it Here is my code:

     "domain">[('type', '=', 'out_invoice'),('invoice_line_ids.branch_id', 'in', uid.branch_ids.ids)]

when I run this code gives me this error: object has no attribute 'branch_ids', but I have the branch_ids in my res.users model


Awatar
Odrzuć
Autor Najlepsza odpowiedź

I solved it this is the answer:

@api.model
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
domain = domain or []
if self.env.context.get('default_type') == 'out_invoice' or self.env.context.get(
'default_type') == 'in_invoice':
domain.append(['invoice_line_ids.branch_id', 'in', self.env.user.branch_ids.ids])
return super(AccountMove, self).search_read(domain, fields, offset, limit, order)

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
cze 23
2252
1
sty 23
2140
0
wrz 22
1976
0
sie 22
2130
1
mar 22
1712