0

I want to hide a row based on a condition.The tree view is one2many field.If the od_state = cancel,then the row should be invisible code:

<field name="line_id">
<tree editable='bottom' >
      <field name="name" attrs="{'invisible':[('state','=','cancel')]}"/>
      <field name="date" attrs="{'invisible':[('state','=','cancel')]}"/>
      <field name="state" invisible="1"/>
</tree>
</field>

The above code hides the data in line(row),but the line is still visible.

Output:

enter image description here

HVH
  • 249
  • 6
  • 14

1 Answers1

0

You can hide rows of a tree by adding a domain on the ir.actions.act_window

    <record model="ir.actions.act_window" id="id_name">
      <field name="name">name</field>
      <field name="res_model">res.model</field>
      <field name="domain">[('state', '=', 'cancel')]</field>
      <field name="view_mode">tree,form</field>
    </record>