تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5553 أدوات العرض

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
5
سبتمبر 19
6251
1
أكتوبر 24
1487
3
أكتوبر 23
8635
1
سبتمبر 23
3246
1
مايو 23
2220