On 2018-07-23 21:56, Richmond Fiko wrote:
> I have a little noob question. In a form view, is it possible to hide a group 
> with a condition for instance in:
> 
>         <label name="is_insured"/>
>         <field name="is_insured"/>
>     <newline/>
>     <group string="Insurance Infos" id="statement_insurance_info">
>         <label name="insurance_part"/>
>         <field name="insurance_part"/>
>         <label name="insurance_number"/>
>         <field name="insurance_number"/>  
>         <label name="party_insurance"/>
>         <field name="party_insurance"/>   
>     </group>
> 
> 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?

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.

http://doc.tryton.org/4.8/trytond/doc/ref/models/models.html#trytond.model.ModelView.view_attributes


-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20180724081846.rqb5gd6vpo6frig5%40kei.

Reply via email to