[REF] website_sale: adapt code after jQuery update

Part of task 1896658

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Co-authored-by: svs-odoo <svs@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
This commit is contained in:
Vincent Schippefilt
2019-03-06 20:07:17 +01:00
committed by Aaron Bohy
co-authored by Aaron Bohy Christophe Matthieu Mathieu Duckerts-Antoine David Monjoie Martin Geubelle svs-odoo
parent b06dacd358
commit d093d1aeba
3 changed files with 10 additions and 8 deletions
@@ -21,7 +21,7 @@ WebsiteNewMenu.include({
* and redirects the user to this new product.
*
* @private
* @returns {Deferred} Unresolved if there is a redirection
* @returns {Promise} Unresolved if there is a redirection
*/
_createNewProduct: function () {
var self = this;
@@ -29,18 +29,18 @@ WebsiteNewMenu.include({
id: "editor_new_product",
window_title: _t("New Product"),
input: _t("Name"),
}).then(function (name) {
if (!name) {
}).then(function (result) {
if (!result.val) {
return;
}
return self._rpc({
route: '/shop/add_product',
params: {
name: name,
name: result.val,
},
}).then(function (url) {
window.location.href = url;
return $.Deferred();
return new Promise(function () {});
});
});
},
@@ -56,7 +56,7 @@ require('web.dom_ready');
var options = require('web_editor.snippets.options');
if (!$('.js_sale').length) {
return $.Deferred().reject("DOM doesn't contain '.js_sale'");
return Promise.reject("DOM doesn't contain '.js_sale'");
}
$('.oe_website_sale').on('click', '.oe_currency_value:o_editable', function (ev) {
@@ -69,7 +69,7 @@ publicWidget.registry.WebsiteSaleOptions = publicWidget.Widget.extend(ProductCon
false
);
return productReady.done(function (productId) {
productReady.then(function (productId){
$form.find(productSelector.join(', ')).val(productId);
self.rootProduct = {
@@ -96,6 +96,8 @@ publicWidget.registry.WebsiteSaleOptions = publicWidget.Widget.extend(ProductCon
return self.optionalProductsModal.opened();
});
return productReady;
},
/**
@@ -34,7 +34,7 @@ tour.register('shop_mail', {
'domain': "https://domain-not-used.fr",
}],
});
$.when(def1, def2).then(function (data) {
Promise.all([def1, def2]).then(function (data) {
window.location.href = '/shop?search=Acoustic Bloc Screens';
});
},