[FW][FIX] website_sale_stock_wishlist: product not found

In the wishlist, if a product has no stock available, the customer can request to be notified when the product is "back in stock".

If a barcode is configured on the product, the request will fail with a "Missing record" error.

Indeed, the code relied on the tracking info (google analytics data) to find the product id.  This is a mistake since the barcode is given as `item_id` in the tracking info if set (instead of the product id).

Since the product id information is already available as node data, use this mean to get the right product id directly.

Fixes #130471

closes odoo/odoo#130949

Forward-port-of: odoo/odoo#130473
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Turkesh Patel
2023-08-07 10:58:52 +02:00
parent 00d8aef1c7
commit 23ecf40ced
@@ -14,7 +14,7 @@ WebsiteSale.include({
},
_onClickSubmitWishlistStockNotificationForm(ev) {
const productId = JSON.parse(ev.currentTarget.closest('tr').dataset.productTrackingInfo).item_id;
const productId = ev.currentTarget.closest('tr').dataset.productId;
this._handleClickSubmitStockNotificationForm(ev, productId);
},
});