Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
6162 Представления

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
сент. 24
1617
0
февр. 21
15
1
окт. 23
7857
0
февр. 25
1432
0
янв. 25
1202