group "Insurance infos" will be hide if is_insured (a bool field) is false and will appear if the field is set true.
If is it possible, how can I do it?
Thanks
Cédric Krier
unread,
Jul 24, 2018, 4:20:06 AM7/24/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tryton
Yes, you can. You must override view_attributes of the Model to return
the xpath that match the group and set a 'states' attribute with the
PYSON expression that will make 'invisible' state True.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tryton
Something like:
@classmethod
def view_attributes(cls):
# Hide the group when is_insured is not
# true
return [('//group[@id="statement_insurance_info"]', 'states', {
'invisible': Not(Bool(Eval('is_insured'))),
})]
Cédric Krier
unread,
Jul 24, 2018, 7:25:06 AM7/24/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tryton
On 2018-07-24 03:37, Richmond Fiko wrote:
You should always call super for modularity, otherwise it seems OK.
You could simplify the PYSON expression: ~Eval('is_insured')
Richmond Fiko
unread,
Jul 24, 2018, 7:55:06 AM7/24/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message