Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4393 มุมมอง

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
9395
6
ส.ค. 20
9378
0
เม.ย. 15
8168
1
ส.ค. 23
16386
What is domain_force in Odoo? แก้ไขแล้ว
2
ก.พ. 24
14850