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

Hi odoo masters.


I'm trying to add a domain in the xml, in a many2one field.

But I get the error "name 'self' is not defined"

this is the xml:


name="products_id" domain="[('company_id','=',self.env.user.company_list)]"

Thanks in advance! :)

Awatar
Odrzuć
Najlepsza odpowiedź

You cannot use self or dot notation in the xml views. You could add a related or computed field to the model and access this value for your domain, or apply the domain in the model.

Awatar
Odrzuć
Autor Najlepsza odpowiedź

Thanks Jort, I made it with the Web domain field from OCA and problem solved.

Awatar
Odrzuć

Can you share an example to resolve your problem ?

Powiązane posty Odpowiedzi Widoki Czynność
2
paź 21
9040
6
sie 20
9083
0
kwi 15
7887
1
sie 23
16058
2
lut 24
14417