- Define an attribute called attrs on a form element:
<field name="parent_id"
attrs="{
'invisible': [('is_company', '=', True)],
'required': [('is_company', '=', False)]
}" />
- Ensure that all the fields you refer to are available in your form:
<field name="is_company" invisible="True" />
This will make the parent_id field invisible if the partner is a company, and required if it's not a company.