Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
4153 Näkymät

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

Avatar
Hylkää
Paras vastaus

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.

Avatar
Hylkää
Tekijä Paras vastaus

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

Avatar
Hylkää

Can you share an example to resolve your problem ?

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
lokak. 21
9087
6
elok. 20
9118
0
huhtik. 15
7910
1
elok. 23
16078
2
helmik. 24
14438