How to use Visual in XML (Tree, Form)

How to use visual in xml?
I had tried to use visual as the code below for field to_pallet or to_cartons, still do not see the effect

Below is my sample code:

<tree editable="bottom">
    <field name="stock" readonly="1"/>
    <field name="bin_loc" string="Current Bin"/>
    <field name="quantity" />
    <field name="cartons" />
    <field name="to_location"/>
    <field name="to_bin_loc"/>
    <field name="to_quantity" string="Transfer Qty" visual="warning"/>
    <field name="to_cartons" string="Transfer Carton"/>
    <field name="to_pallet" visual="If(Eval('draft'), 'warning', '') pyson='1'/>
    <field name="to_stock" readonly="1" string="To Stock"/>
    <field name="state"/>

As visual is pyson attribute it should be encodded using the view_attributes function.

There is an example on the account_invoice module

Hi Pokoli, thank you for your fast response.

If let say, my tree is from parent.

If I want to select “child_field2”, how to xpath?

I had tried this but it not work

Below is pseudo code:

child_id: child_tree

    <field name="child_field1"/>
    <field name="child_field2"/>


    <field name="parent1"/>
     <field name="parent2"/>
     <field name="lines" view_ids="child_tree"/>

If you want to modify the view of lines, you must add your view_attributes on the Model of the lines and use a xpath expression for the child_tree view.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.