States and Eval in Views

34 views
Skip to first unread message

Jürgen Stiefel

unread,
Mar 17, 2016, 5:05:04 PM3/17/16
to tryton
Hi everbody,

trying to switch a label on and off with the following statement within a module view definition.

            <label name="surface_properties" states="{'invisible': Eval('active', True)}"/>

But all I receive is an error message "Invalid XML for View ...".
Can anyone help to fix this problem.

Thanks and regards
Jürgen

Cédric Krier

unread,
Mar 17, 2016, 5:25:03 PM3/17/16
to tryton
On 2016-03-17 13:00, Jürgen Stiefel wrote:
> trying to switch a label on and off with the following statement within a
> module view definition.
>
> <label name="surface_properties" states="{'invisible':
> Eval('active', True)}"/>
>
> But all I receive is an error message "Invalid XML for View ...".
> Can anyone help to fix this problem.

You can not more put Python code in XML, it must be PYSONinfied.
The easiest way to do that is by using ModelView.view_attributes
http://doc.tryton.org/3.8/trytond/doc/ref/models/models.html?#trytond.model.ModelView.view_attributes

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
Reply all
Reply to author
Forward
0 new messages