跳至內容
選單
此問題已被標幟
1 回覆
6108 瀏覽次數

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

頭像
捨棄
最佳答案

Hi,

You can give required using the attributes like below,

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

Thanks

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
9月 24
1597
0
2月 21
15
1
10月 23
7781
0
2月 25
1330
0
1月 25
1147