Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
4007 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

Can you share an example to resolve your problem ?

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 21
8951
6
thg 8 20
8957
0
thg 4 15
7777
1
thg 8 23
15940
2
thg 2 24
14261