Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
4006 Vizualizări

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! :)

Imagine profil
Abandonează
Cel mai bun răspuns

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.

Imagine profil
Abandonează
Autor Cel mai bun răspuns

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

Imagine profil
Abandonează

Can you share an example to resolve your problem ?

Related Posts Răspunsuri Vizualizări Activitate
2
oct. 21
8950
6
aug. 20
8954
0
apr. 15
7775
1
aug. 23
15939
2
feb. 24
14259