From f96c5a61a98f6a47ba59e50f3e2c643e227d58cf Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Mon, 10 Jul 2023 09:32:47 +0000 Subject: [PATCH] [FIX] website_sale: unable to confirm zero-amount cart When the cart has a zero amount (because of pricelist, coupons, ...), providers are not loaded nor displayed. Furthermore, if there is no need for delivery (because the cart only contains services), delivery carriers logic is not loaded either. In this case, without carriers nor providers managing the disabling/enabling of the confirmation button (o_payment_submit_button), the base logic handling the T&C checkbox didn't properly enable the button when it should have. Introduced by 608e90e998107f8b834d4edc8ea918041725c551, already fixed for payment form by 04059d09dfd7dc57a5c86c842d6fea300e1441aa opw-3418472 closes odoo/odoo#127950 X-original-commit: d3bcf03adb93d2727ed81e1b9ffe0a2bbc5707b0 Signed-off-by: Victor Feyens (vfe) --- addons/website_sale/static/src/js/website_sale_payment.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/website_sale/static/src/js/website_sale_payment.js b/addons/website_sale/static/src/js/website_sale_payment.js index b25e0996a91..2711453f906 100644 --- a/addons/website_sale/static/src/js/website_sale_payment.js +++ b/addons/website_sale/static/src/js/website_sale_payment.js @@ -1,5 +1,5 @@ /** @odoo-module **/ - + import { debounce } from "@web/core/utils/timing"; import checkoutForm from "payment.checkout_form"; import publicWidget from "web.public.widget"; @@ -116,7 +116,9 @@ import checkoutForm from "payment.checkout_form"; */ _onClickTCCheckbox: function () { this._adaptConfirmButton(); - const disabledReasonFound = this.$submitButton.data("disabled_reasons"); + const disabledReasonFound = Object.values( + this.$submitButton.data("disabled_reasons") || {} + ).includes(true); this.$submitButton.prop('disabled', disabledReasonFound); }, }));