Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5687 Lượt xem

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


Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you Cybrosys, works like a charm. Regards

Bài viết liên quan Trả lời Lượt xem Hoạt động
5
thg 9 19
6415
1
thg 10 24
3262
3
thg 10 23
9065
1
thg 9 23
3431
1
thg 5 23
2406