From 24d1b05931dea6da0ed184cba1e97d67c3d9841b Mon Sep 17 00:00:00 2001 From: Cedric Collins Date: Tue, 28 Sep 2021 14:36:02 -0500 Subject: [PATCH] [IMP] website_sale_payment_terms: leave payment button disabled if other modules set disabled reasons --- website_sale_payment_terms/static/src/js/payment_terms.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/website_sale_payment_terms/static/src/js/payment_terms.js b/website_sale_payment_terms/static/src/js/payment_terms.js index dfcfccb4..078df856 100644 --- a/website_sale_payment_terms/static/src/js/payment_terms.js +++ b/website_sale_payment_terms/static/src/js/payment_terms.js @@ -137,14 +137,17 @@ odoo.define('website_sale_payment_terms.payment_terms', function (require) { * @private */ _acceptPaymentTerms: function () { - $('#o_payment_form_pay').prop('disabled', false); + var $payButton = $('#o_payment_form_pay'); + var disabledReasons = $payButton.data('disabled_reasons') || {}; + disabledReasons.payment_terms_selection = false; + $payButton.data('disabled_reasons', disabledReasons); + $payButton.prop('disabled', _.contains($payButton.data('disabled_reasons'), true)); }, /* * @private */ _denyPaymentTerms: function () { - $('#o_payment_form_pay').prop('disabled', true); window.location = '/shop/reject_term_agreement'; }, });