Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
19425 Widoki

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

<if........>
<field name="name" />
<if......./>
Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć