跳至內容
選單
此問題已被標幟
2 回覆
3990 瀏覽次數

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
8939
6
8月 20
8918
0
4月 15
7764
1
8月 23
15921
2
2月 24
14244