Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
4108 Переглядів

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

Аватар
Відмінити
Найкраща відповідь

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.

Аватар
Відмінити
Автор Найкраща відповідь

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

Аватар
Відмінити

Can you share an example to resolve your problem ?

Related Posts Відповіді Переглядів Дія
2
жовт. 21
9035
6
серп. 20
9074
0
квіт. 15
7886
1
серп. 23
16058
2
лют. 24
14414