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

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?

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

Try this

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 9 20
72269
1
thg 9 19
3458
2
thg 9 23
10021
1
thg 4 22
2942
0
thg 3 15
5048