From e2c6b088f0d774451446986339cf6dcf05db665c Mon Sep 17 00:00:00 2001 From: "Anita (anko)" Date: Mon, 15 Jan 2024 16:32:27 +0000 Subject: [PATCH] [FIX] payment: express checkout removed for free carts If user changed quantity of products to amount that would create free cart, without refreshing the page, they were still able to use express checkout which was causing an error. If user has free cart now, it will make express checkout button dissapear. task-3568644 closes odoo/odoo#160386 X-original-commit: 0b47abaa6d682fb5c243d1b36dbed263343ce586 Signed-off-by: Antoine Vandevenne (anv) Signed-off-by: anko-odoo --- addons/payment/static/src/js/express_checkout_form.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/payment/static/src/js/express_checkout_form.js b/addons/payment/static/src/js/express_checkout_form.js index c511299ba02..7eb90ed73fb 100644 --- a/addons/payment/static/src/js/express_checkout_form.js +++ b/addons/payment/static/src/js/express_checkout_form.js @@ -82,6 +82,13 @@ publicWidget.registry.PaymentExpressCheckoutForm = publicWidget.Widget.extend({ _updateAmount(newAmount, newMinorAmount) { this.paymentContext.amount = parseFloat(newAmount); this.paymentContext.minorAmount = parseInt(newMinorAmount); + this._getExpressCheckoutForms().forEach(form => { + if (newAmount == 0) { + form.classList.add('d-none')} + else { + form.classList.remove('d-none') + } + }) }, });