Search code examples
xmlxml-parsingodoo

if one field is filled other field is required in xml?


<field name="warranty_from" attrs = "{'readonly': [('state','in',['approved'])]}"/>
<field name="expiry_date" attrs = "{'readonly': [('state','in',['approved'])]}"/>

How to write a condition in xml if one (warranty_from) field is filled then expiry_date should not be empty?


Solution

  • your xml could be as following:

    <field name="warranty_from" attrs = "{'readonly': [('state','in',['approved'])]}"/>
    <field name="expiry_date" attrs = "{'required': [('warranty_from','!=', False)]}"/>