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

Hi everyone,

I tried this post tips here https://accounts.openerp.com/forum/Help-1/question/13042

It works for me as below

<field name="x_is_family_coverage" string="Is Family Coverage?"> </field>
                                   <field name="x_eb_partner_name" attrs="{'invisible':[('x_is_family_coverage', '==', False)]}"> </field>
                                   <field name="x_eb_partner_eb_no" attrs="{'invisible':[('x_is_family_coverage', '==', False)]}"> </field>

But what if when I check the "Is Family Coverage?" checkbox, I also want to make the fields x_eb_partner_name and x_eb_partner_eb_no required/compulsory too? If uncheck the "Is Family Coverage?" checkbox, then both fields are not required.

Any idea? Thanks.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
attrs="{'invisible':[('x_is_family_coverage', '==', False)],'required':[('x_is_family_coverage', '==', False)]}"
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

The attrs can be indicates all in the some dictonary:

<field name="x_eb_partner_name" attrs="{'invisible':[('x_is_family_coverage', '=', False)], 'required':[('x_is_family_coverage', '=', False)]}" />

If I have understand.

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

Thanks :) I will give that a try :) But I assume this is the right way to add conditional to the field xml directly? Or is it better I duplicate a module and start writing python codes? which one is better?

I prefer to use this type of filter in xml code, so if someone inherit my module can change them in a simple way.

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 24
6786
3
ส.ค. 22
4154
1
พ.ย. 24
27810
1
ต.ค. 22
9805
1
ก.ค. 22
2631