How to make a field (in)visible dependant on another field's value?

  • language
      English
  • type
      technical
  • info created for version
      14.0
  • mvc
      XML (records/views/templates)
Add to Cart

<field name="field_id" attrs="{'invisible': [('other_field_id', '=', False)]}"/>

Note that the other_field_id should be present in the view. If you don't want it to be visible just add it with the invisible value set to 1, as for example ...

<field name="other_field_id" invisible="1"/>

You cannot use dot notation so if you need a field from another model, create it as a related field in your model to access it.