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

I have a many2one field and I want to add a domain filter to it but I cannot get it to work even though it works as a search filter.


This is how I would like to filter it

[('res_id','=',production_id.id),('res_model','=',production_id._name)]


How can I apply this to a Many2one field?

الصورة الرمزية
إهمال
أفضل إجابة

Try this

department_id=fields.Many2one('hr.department','Department',domain="[('company_id','=',campus_id)]")

الصورة الرمزية
إهمال
الكاتب

I was sure I had tried that in the XML domain but I didn't think to try it in python with the quotations. Such a simple answer to a big headache but I am glad it worked! Thank you very much

المنشورات ذات الصلة الردود أدوات العرض النشاط
3
سبتمبر 20
72290
1
سبتمبر 19
3468
2
سبتمبر 23
10036
1
أبريل 22
2953
0
مارس 15
5051