Hide field in a tree view

vITraining Admin

This code is used to hide fields in one2many(tree) in Odoo > 11

<field name="my_field" attrs="{'column_invisible': [('parent.field_name','=',False)]}" />

this type of code only works gives 'parent' in condition

For example: sale.order and sale.order.line, where sale.order has a field called field_name

to show/hide columns in sale.order.line tree view on sale.order form, use the parent.field_name domain on the sale.order.line tree field.