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

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ก.ย. 20
72298
1
ก.ย. 19
3483
2
ก.ย. 23
10052
1
เม.ย. 22
2967
0
มี.ค. 15
5059