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

Hi all,

I am new to Odoo and using version 12 for learning.

I have a form with 2 fields.  Field_1 and Field_2.

I want to make "Field_2" readonly if Field_1 is not filled.

How can I achieve that?

Thank you in advance

Best regards


อวตาร
ละทิ้ง

This Odoo customization tips will helps you: http://learnopenerp.blogspot.com

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

Hi,

Simply what you can do is that use attributes, take the case of field_1 and field_2.

In the XML, you can define the field_2 like this, so that the field_2 will be read-only until there is a value in field_1.


<field name="field_2" attrs="{'readonly':[('field_1','=',False)]}"/>


Thanks

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

Thank you Cybrosys, works like a charm. Regards

Related Posts ตอบกลับ มุมมอง กิจกรรม
5
ก.ย. 19
6298
1
ต.ค. 24
1642
3
ต.ค. 23
8741
1
ก.ย. 23
3308
1
พ.ค. 23
2249