Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
19535 Visualizzazioni

Can I use "if" in a xml file (tree view)? How can I do this? e.g:

<if........>
<field name="name" />
<if......./>
Avatar
Abbandona
Risposta migliore

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.

Avatar
Abbandona