تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
4157 أدوات العرض

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
أكتوبر 21
9108
6
أغسطس 20
9126
0
أبريل 15
7917
1
أغسطس 23
16089
2
فبراير 24
14445