[FIX] website_sale: fix modal price when Select Quantity is disabled
To reproduce:
- Go on the website page of a product with optional products.
- Disable the Select Quantity customize show.
- Click add to cart.
This will open the optional product modal, where the quantity will be displayed.
However changing that quantity will have no effect, especially the price will
not update accordingly.
The real issue is that the quantity should not be displayed there if Select
Quantity is disabled, but this has never worked before, so this is outside the
scope of this fix.
Anyway, since the quantity is present there, we would at least expect it to
correctly recompute the price, which worked fine when the modal was introduced,
but has been broken since 51e51055bf
opw-2005317
closes odoo/odoo#33992
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
committed by
Nicolas Martinelli
parent
4b8f72eb23
commit
bb9c3910bb
@@ -129,11 +129,20 @@ sAnimations.registry.WebsiteSaleOptions = sAnimations.Class.extend(ProductConfig
|
||||
* @param {integer} quantity
|
||||
*/
|
||||
_onOptionsUpdateQuantity: function (quantity) {
|
||||
this.$form
|
||||
var $qtyInput = this.$form
|
||||
.find('.js_main_product input[name="add_qty"]')
|
||||
.first()
|
||||
.val(quantity)
|
||||
.trigger('change');
|
||||
.first();
|
||||
|
||||
if ($qtyInput.length) {
|
||||
$qtyInput.val(quantity).trigger('change');
|
||||
} else {
|
||||
// This handles the case when the "Select Quantity" customize show
|
||||
// is disabled, and therefore the above selector does not find an
|
||||
// element.
|
||||
// To avoid duplicating all RPC, only trigger the variant change if
|
||||
// it is not already done from the above trigger.
|
||||
this.optionalProductsModal.triggerVariantChange(this.optionalProductsModal.$el);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user