跳至内容
菜单
此问题已终结
2 回复
4000 查看

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 ?

相关帖文 回复 查看 活动
2
10月 21
8945
6
8月 20
8937
0
4月 15
7765
1
8月 23
15928
2
2月 24
14248