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


I have a 3 char fields and 1 many2many field. Below is code

brand = fields.char ('Brand')

lang = fields.char ('Language')

ref = fields.char ('Reference')

product_ids = fields.Many2many ('product.product', Products')

How can i hide fields based on many2many multiple selection? Example if product A selected selected then BRAND should be visible and when product B selected LANG should be visible, when Product C selected then REF should be visible vice versa.

There can be multiple selection like product A and B selected together then BRAND & LANG both visible.

Please note I dont want to use boolean fields for hiding char fields



อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Better you do it with a compute boolean field. In the compute method, you can set True / False value to the boolean field depending on your condition (True or Product A-B and False for Product C-D).

Now, use this boolean field in attrs to hide your fields.

อวตาร
ละทิ้ง
ผู้เขียน

Hi. I have edited my question with more complex scenario. Can you please review. Thanks

ผู้เขียน คำตอบที่ดีที่สุด

Solution found.

See below url-

https://stackoverflow.com/questions/56985481/make-multiple-fields-invisible-with-many2many-field-odoo?noredirect=1#comment100509645_56985481

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
เม.ย. 21
5361
2
มี.ค. 15
8804
1
ส.ค. 23
3173
0
พ.ย. 21
2265
Attrs multiple condition. Boolean AND. แก้ไขแล้ว
4
ต.ค. 21
79884