[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 608e90e998, already fixed
for payment form by 04059d09dfd7dc57a5c86c842d6fea300e1441aa

opw-3418472

closes odoo/odoo#127950

X-original-commit: d3bcf03adb93d2727ed81e1b9ffe0a2bbc5707b0
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2023-07-10 16:59:55 +02:00
parent e1295ee65f
commit f96c5a61a9
@@ -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);
},
}));