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

Hello,


I developped a little module that adds 2 boolean fields into res.partner.tags. (customer and supplier)


I would like load the category_id of res.partner view depending on this new fields. If I open the form view by customer menu, I want that it loads the categories marked like customer, if I open the form by supplier menu, I want that it loads categories marked like supplier and if I open contact view, it should show all categories. 


I saw that this 3 actions call the same form view and I don't know how adapt the domain in this field.


Somebody knows how do that?


Thank you in advance


อวตาร
ละทิ้ง

Bravo! Thank you very much! It works very good!

Happy to help you

คำตอบที่ดีที่สุด

You could do that by using the context values on each of those actions. Suppliers have a context setted with a search_default_supplier = 1. Customers have search_default_customer = 1. You could use it in your domains combining & with | to get the desired domain. Something like this:

<field name="category_id" domain="['|',('field_bool_supp', '=', bool(context.get('search_default_supplier', 0))),('field_bool_cust', '=', bool(context.get('search_default_customer', 0)))]"/>

อวตาร
ละทิ้ง

please vote if that's ok to you

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ต.ค. 23
2036
0
ก.ค. 20
2966
0
ก.ย. 24
1451
2
พ.ค. 24
3386
3
พ.ค. 24
6879