[IMP] website_sale_payment_terms: leave payment button disabled if other modules set disabled reasons

This commit is contained in:
Cedric Collins
2021-09-28 14:36:02 -05:00
parent 7c6c933f96
commit 24d1b05931

View File

@@ -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';
},
});