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

I have been searching to find a solution to this but couldn't find the solution for it.
When you go to Contacts -> create a new contact, firstly you can choose a selection for "Individual" or "Company".
Depending on wich option you choose the "VAT" field should required when you choose "Company", but when you choose "Individual" it is not required.

In the template file located Settings -> User Interface -> Views -> res.partner.vat.inherit i can set the field to required="True".
But then it is required for both the selections. Is it possible to make a check with attr="" depending on the selection when its required or not?

Odoo 11 Community

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

You can give required using the attributes like below,

<field name="test" attrs="{'required': [('selection_field_name','=', 'value')]}"/>

Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 24
1615
0
thg 2 21
15
1
thg 10 23
7856
0
thg 2 25
1431
0
thg 1 25
1202