This question has been flagged
3330 Views

For portal user i want the list of field values appear based on the value chosen by this portal user for example :

If this portal user chooses the country, only institutions in the selected country must appear in the list of institutions  field

My code in Qweb:

 <div t-attf-class="form-group #{error.get('country_id') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="country_id">Country</label>
<select name="country_id" t-attf-class="form-control #{error.get('country_id') and 'is-invalid' or ''}">
<option value="">Country...</option>
<t t-foreach="countries or []" t-as="country">
<option t-att-value="country.id" t-att-selected="country.id == int(country_id) if country_id else country.id == partner.country_id.id">
<t t-esc="country.name" />
</option>
</t>
</select>
</div>


<div t-attf-class="form-group #{error.get('institution_id') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label label-optional" for="institution_id">Health Center</label>
<select name="institution_id" t-attf-class="form-control #{error.get('institution_id') and 'is-invalid' or ''}">
<option value="">select...</option>
<t t-foreach="institutions or []" t-as="institution">
<option t-att-value="institution.id" t-att-country_id="institution.country_id.id" >
<t t-esc="institution.name" />
</option>
</t>
</select>
</div>
 
Avatar
Discard