[REF] website_sale_wishlist: 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:
committed by
Aaron Bohy
co-authored by
Aaron Bohy
Christophe Matthieu
Mathieu Duckerts-Antoine
David Monjoie
Martin Geubelle
svs-odoo
parent
4032be506a
commit
a74169bb09
@@ -42,7 +42,7 @@ publicWidget.registry.ProductWishlist = publicWidget.Widget.extend(ProductConfig
|
||||
self.wishlistProductIDs = JSON.parse(res);
|
||||
});
|
||||
|
||||
return $.when(def, wishDef);
|
||||
return Promise.all([def, wishDef]);
|
||||
},
|
||||
/**
|
||||
* Updates the wishlist view (navbar) & the wishlist button (product page).
|
||||
@@ -95,7 +95,7 @@ publicWidget.registry.ProductWishlist = publicWidget.Widget.extend(ProductConfig
|
||||
false
|
||||
);
|
||||
|
||||
productReady.done(function (productId) {
|
||||
productReady.then(function (productId) {
|
||||
productId = parseInt(productId, 10);
|
||||
|
||||
if (productId && !_.contains(self.wishlistProductIDs, productId)) {
|
||||
@@ -108,11 +108,11 @@ publicWidget.registry.ProductWishlist = publicWidget.Widget.extend(ProductConfig
|
||||
self.wishlistProductIDs.push(productId);
|
||||
self._updateWishlistView();
|
||||
wSaleUtils.animateClone($('#my_wish'), $el.closest('form'), 25, 40);
|
||||
}).fail(function () {
|
||||
}).guardedCatch(function () {
|
||||
$el.prop("disabled", false).removeClass('disabled');
|
||||
});
|
||||
}
|
||||
}).fail(function () {
|
||||
}).guardedCatch(function () {
|
||||
$el.prop("disabled", false).removeClass('disabled');
|
||||
});
|
||||
},
|
||||
@@ -138,16 +138,17 @@ publicWidget.registry.ProductWishlist = publicWidget.Widget.extend(ProductConfig
|
||||
|
||||
this._rpc({
|
||||
route: '/shop/wishlist/remove/' + wish,
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
$(tr).hide();
|
||||
});
|
||||
|
||||
this.wishlistProductIDs = _.without(this.wishlistProductIDs, product);
|
||||
if (this.wishlistProductIDs.length === 0) {
|
||||
deferred_redirect = deferred_redirect ? deferred_redirect : $.Deferred();
|
||||
deferred_redirect.then(function () {
|
||||
self._redirectNoWish();
|
||||
});
|
||||
if (deferred_redirect) {
|
||||
deferred_redirect.then(function () {
|
||||
self._redirectNoWish();
|
||||
});
|
||||
}
|
||||
}
|
||||
this._updateWishlistView();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user