-
-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] website_sale_checkout_country_vat: Migration to version 18.0
TT54387
- Loading branch information
1 parent
0aff28b
commit df8a7fe
Showing
7 changed files
with
50 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,7 @@ Contributors | |
- Alexandre Díaz | ||
- Carlos Roca | ||
- Ernesto Tejeda | ||
- Pilar Vargas | ||
|
||
Maintainers | ||
----------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
- Alexandre Díaz | ||
- Carlos Roca | ||
- Ernesto Tejeda | ||
- Pilar Vargas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
website_sale_checkout_country_vat/static/src/js/dropdown.esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* Copyright 2016-2017 Jairo Llopis <[email protected]> | ||
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ | ||
import publicWidget from "@web/legacy/js/public/public_widget"; | ||
|
||
publicWidget.registry.CheckoutCountryVatDropdown = publicWidget.Widget.extend({ | ||
selector: | ||
".o_wsale_address_fill:has(.js_country_dropdown, select[name=country_id])", | ||
events: { | ||
"change select[name=country_id]": "_onChangeAddressCountry", | ||
}, | ||
start: function () { | ||
const result = this._super(...arguments); | ||
this.$address_country = this.$("select[name=country_id]"); | ||
this.$vat_no_country_field = this.$("#no_country_field"); | ||
return result; | ||
}, | ||
|
||
/** | ||
* Change VAT flag when address country changes | ||
* @private | ||
*/ | ||
_onChangeAddressCountry: function () { | ||
if (!this.$address_country || !this.$vat_no_country_field) return; | ||
if (this.$address_country.val() && !this.$vat_no_country_field.val()) { | ||
this._getCountryOption( | ||
this.$address_country.find("option:selected").attr("code") | ||
).click(); | ||
} | ||
}, | ||
|
||
/** | ||
* Get a country element inside the vat dropdown | ||
* | ||
* @private | ||
* @param {String} country_code | ||
* @returns {jQueryElement} | ||
*/ | ||
_getCountryOption: function (country_code) { | ||
return this.$(`.js_select_country_code[data-country_code='${country_code}']`); | ||
}, | ||
}); |
41 changes: 0 additions & 41 deletions
41
website_sale_checkout_country_vat/static/src/js/dropdown.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters