Skip to content
Permalink
Browse files

[FIX] website_sale_delivery: don't replace error message by 'Free'

When a delivery carrier can't compute the delivery price, it returns an error
that is shown instead of the price (eg 'bpost Domestic is used only to ship
inside Belgium..').

But since 1ab53c2 everytime the user compute a carrier price and there is a
coupon allowing free delivery, every listed delivery carrier would have their
badges set to 'Free', including also carrier in error state.

This commit will not replace the error message by 'Free'.

Coming from odoo#31857
  • Loading branch information...
rdeodoo committed Mar 18, 2019
1 parent d1d7cc2 commit ec83faf50fbb4c2a734f870b7d40307485e7a15b
Showing with 5 additions and 2 deletions.
  1. +5 −2 addons/website_sale_delivery/static/src/js/website_sale_delivery.js
@@ -51,8 +51,9 @@ publicWidget.registry.websiteSaleDelivery = publicWidget.Widget.extend({
// Update discount of the order
$('#order_discounted').find('.oe_currency_value').text(result.new_amount_order_discounted);

// We are in freeshipping, so every carrier is Free
$('#delivery_carrier .badge').text(_t('Free'));
// We are in freeshipping, so every carrier is Free but we don't
// want to replace error message by 'Free'
$('#delivery_carrier .badge:not(.o_wsale_delivery_carrier_error)').text(_t('Free'));
}

if (result.status === true) {
@@ -63,10 +64,12 @@ publicWidget.registry.websiteSaleDelivery = publicWidget.Widget.extend({
$carrierBadge.children('span').text(result.new_amount_delivery);
$carrierBadge.removeClass('d-none');
$computeBadge.addClass('d-none');
$computeBadge.removeClass('o_wsale_delivery_carrier_error');
$payButton.data('disabled_reasons').carrier_selection = false;
$payButton.prop('disabled', _.contains($payButton.data('disabled_reasons'), true));
} else {
console.error(result.error_message);
$computeBadge.addClass('o_wsale_delivery_carrier_error');
$computeBadge.text(result.error_message);
$amountDelivery.text(result.new_amount_delivery);
$amountUntaxed.text(result.new_amount_untaxed);

0 comments on commit ec83faf

Please sign in to comment.
You can’t perform that action at this time.