Can I use "if" in a xml file (tree view)? How can I do this? e.g:
<if........>
<field name="name" />
<if......./>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Can I use "if" in a xml file (tree view)? How can I do this? e.g:
<if........>
<field name="name" />
<if......./>
You can use the attrs
attribute on form fields, to make them contitionally visible or required.
From the documentation:
attrs: Permits to define attributes of a field depends on other fields of the same window. (It can be use on page, group, button and notebook tag also)
Example:
<field name="volume" attrs="{'readonly':[('type','=','service')]}"/>
Views also use the QWeb template engine, used in many Kanban views, and it includes a t-if=condition
element, but this is not very well documented.
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
Aanmelden