Skip to content

Commit

Permalink
l10n_br_website_sale: Fix sale partner public form
Browse files Browse the repository at this point in the history
  • Loading branch information
felipepaloschi committed Jul 8, 2022
1 parent 4313d24 commit 349a236
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
25 changes: 13 additions & 12 deletions l10n_br_website_sale/static/src/js/website_sale.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,19 @@ odoo.define('br_website_sale.address', function (require) {
},

set_detault_state_city: function(){
$("#id_country").change();
let $state = $('#select_state_id');
let default_state = $("#input_state_id").val();
console.log(default_state);
if(default_state) {
console.log(default_state);
$state.val(default_state);
$state.change();
let $city = $('#select_city_id');
let default_city = $("#input_city_id").val();
console.log(default_city);
$city.val(default_city);
if(this.$el.find("#input_zip").val().length >= 8) {
this.$el.find("#input_zip").trigger('change');
} else {
$("#id_country").change();
let $state = $('#select_state_id');
let default_state = $("#input_state_id").val();
if(default_state) {
$state.val(default_state);
$state.change();
let $city = $('#select_city_id');
let default_city = $("#input_city_id").val();
$city.val(default_city);
}
}
},

Expand Down
8 changes: 4 additions & 4 deletions l10n_br_website_sale/views/website_portal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
<div t-attf-class="form-group #{error.get('country_id') and 'o_has_error' or ''} col-md-6 div_country">
<label class="col-form-label" for="country_id">País</label>
<select id="id_country" name="country_id" t-attf-class="form-control #{error.get('country_id') and 'is-invalid' or ''}">
<option value="">Country...</option>
<option value="">País...</option>
<t t-foreach="countries" t-as="c">
<option t-att-value="c.id" t-att-selected="c.id == (country_id or partner.country_id.id or -1)">
<option t-att-value="c.id">
<t t-esc="c.name"/>
</option>
</t>
Expand All @@ -82,7 +82,7 @@
<select id="select_state_id" name="state_id" t-attf-class="form-control #{error.get('state_id') and 'is-invalid' or ''}">
<option value="">Estado...</option>
<t t-foreach="states or []" t-as="state">
<option t-att-value="state.id" t-att-data-country_id="state.country_id.id" t-att-selected="state.id == (state_id or partner.state_id.id or -1)">
<option t-att-value="state.id" t-att-data-country_id="state.country_id.id">
<t t-esc="state.name"/>
</option>
</t>
Expand All @@ -91,7 +91,7 @@
<div t-attf-class="form-group #{error.get('city_id') and 'o_has_error' or ''} col-lg-6">
<label class="col-form-label" for="city_id">Cidade</label>
<input id="input_city_id" type="hidden" t-att-value="city or partner.city_id.id" />
<select id="select_city_id" name="city_id" t-attf-class="form-control #{error.get('city_id') and 'is-invalid' or ''}">
<select id="select_city_id" name="city_id">
<option value="">Cidade...</option>
</select>
</div>
Expand Down
9 changes: 4 additions & 5 deletions l10n_br_website_sale/views/website_sale_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
<div t-attf-class="form-group #{error.get('country_id') and 'o_has_error' or ''} col-lg-6 div_country">
<label class="col-form-label" for="country_id">País</label>
<select id="id_country" name="country_id" t-attf-class="form-control #{error.get('country_id') and 'is-invalid' or ''}">
<option value="">Country...</option>
<option value="">País...</option>
<t t-foreach="countries" t-as="c">
<option t-att-value="c.id" t-att-selected="c.id == (country and country.id or -1)">
<option t-att-value="c.id">
<t t-esc="c.name"/>
</option>
</t>
Expand All @@ -82,16 +82,15 @@
<div t-attf-class="form-group #{error.get('state_id') and 'o_has_error' or ''} col-lg-6">
<label class="col-form-label" for="state_id">Estado</label>
<input id="input_state_id" type="hidden" t-att-value="(state and state.id or -1)" />
<select id="select_state_id" name="state_id" t-attf-class="form-control #{error.get('state_id') and 'is-invalid' or ''}"
t-att-data-default="'state_id' in checkout and checkout['state_id'] and int(checkout['state_id'])">
<select id="select_state_id" name="state_id" t-attf-class="form-control #{error.get('state_id') and 'is-invalid' or ''}">
<option value="">Estado...</option>
</select>
</div>
<div t-attf-class="form-group #{error.get('city_id') and 'o_has_error' or ''} col-lg-6">
<label class="col-form-label" for="city_id">Cidade</label>
<input id="input_city_id" type="hidden" t-att-value="(city and city.id or -1)" />
<select id="select_city_id" name="city_id" t-attf-class="form-control #{error.get('city_id') and 'is-invalid' or ''}"
t-att-data-default="'city_id' in checkout and checkout['city_id'] and int(checkout['city_id'])">
>
<option value="">Cidade...</option>
</select>
</div>
Expand Down

0 comments on commit 349a236

Please sign in to comment.