summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2019-03-22 11:03:31 +0000
committerSébastien Theys <seb@odoo.com>2019-03-22 11:03:31 +0000
commitb46cdbbda47bb0d53babf62d72b1442cf876a19c (patch)
tree199535669922447e3f1823983bd4a1622d47e2af
parent230ad8c381e927025efabff0f5f8c2debc432249 (diff)
[FIX] website_sale: fix forward-port of product configurator
The method `onChangeVariant` was overridden in 12.2 to fix an issue with the new web editor and separately overridden in 12.0 to fix an issue with the product configurator. After the forward-port, the method was defined twice, and only the second was taken into account. This commit fixes it by merging the two methods. closes odoo/odoo#32041 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
-rw-r--r--addons/website_sale/static/src/js/website_sale.js35
1 files changed, 15 insertions, 20 deletions
diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js
index ec883d9025b..61216b26bd7 100644
--- a/addons/website_sale/static/src/js/website_sale.js
+++ b/addons/website_sale/static/src/js/website_sale.js
@@ -211,24 +211,6 @@ sAnimations.registry.WebsiteSale = sAnimations.Class.extend(ProductConfiguratorM
}
return ProductConfiguratorMixin.getSelectedVariantValues.apply(this, arguments);
},
- /**
- * Write the properties of the form elements in the DOM to prevent the
- * current selection from being lost when activating the web editor.
- *
- * @override
- */
- onChangeVariant: function (ev) {
- var $component = $(ev.currentTarget).closest('.js_product');
- $component.find('input').each(function () {
- var $el = $(this);
- $el.attr('checked', $el.is(':checked'));
- });
- $component.find('select option').each(function () {
- var $el = $(this);
- $el.attr('selected', $el.is(':selected'));
- });
- return ProductConfiguratorMixin.onChangeVariant.apply(this, arguments);
- },
//--------------------------------------------------------------------------
// Private
@@ -601,9 +583,11 @@ sAnimations.registry.WebsiteSale = sAnimations.Class.extend(ProductConfiguratorM
$('.ship_to_other').toggle(!$(ev.currentTarget).prop('checked'));
},
/**
- * @override
- *
* Dirty fix: prevent options modal events to be triggered and bubbled
+ * Also write the properties of the form elements in the DOM to prevent the
+ * current selection from being lost when activating the web editor.
+ *
+ * @override
*/
onChangeVariant: function (ev, data) {
var $originPath = ev.originalEvent && Array.isArray(ev.originalEvent.path) ? $(ev.originalEvent.path) : $();
@@ -612,6 +596,17 @@ sAnimations.registry.WebsiteSale = sAnimations.Class.extend(ProductConfiguratorM
ev.stopPropagation();
return;
}
+
+ var $component = $(ev.currentTarget).closest('.js_product');
+ $component.find('input').each(function () {
+ var $el = $(this);
+ $el.attr('checked', $el.is(':checked'));
+ });
+ $component.find('select option').each(function () {
+ var $el = $(this);
+ $el.attr('selected', $el.is(':selected'));
+ });
+
return ProductConfiguratorMixin.onChangeVariant.apply(this, arguments);
},
/**