From 87aa1891583c4b0af1257ff1ccc011db772e75ee Mon Sep 17 00:00:00 2001 From: jvm-odoo Date: Wed, 1 Jul 2020 11:20:28 +0000 Subject: [PATCH] [FIX] payment: fix portal can click pay when js not loaded Issue - Go to Accounting / Customers / Invoices - Pick any invoice not paid - Action: Generate a Payment Link - Open the link - Refresh the page having Javascript disabled - Click the Pay Now button Traceback Cause If JS is not loaded, the values in the form fields are not bound as expected. It can also happen with slow connections and fast click on the button at the loading. Before the JS is entirely loaded (as it is lazy-loaded). Solution Button disabled by default, wait the page to be loaded and then activate the button OPW-2255760 closes odoo/odoo#54128 X-original-commit: 0e7071f249e69c5cca519ec66120530eb0f97153 Signed-off-by: Jason Van Malder (jvm) --- addons/payment/static/src/js/payment_form.js | 1 + addons/payment/views/payment_templates.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/payment/static/src/js/payment_form.js b/addons/payment/static/src/js/payment_form.js index 6a58732a76c..90f1a4843c5 100644 --- a/addons/payment/static/src/js/payment_form.js +++ b/addons/payment/static/src/js/payment_form.js @@ -22,6 +22,7 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({ * @override */ start: function () { + $("#o_payment_form_pay").removeAttr('disabled'); var self = this; return this._super.apply(this, arguments).then(function () { self.options = _.extend(self.$el.data(), self.options); diff --git a/addons/payment/views/payment_templates.xml b/addons/payment/views/payment_templates.xml index e0e5a57df8e..f1047c0f847 100644 --- a/addons/payment/views/payment_templates.xml +++ b/addons/payment/views/payment_templates.xml @@ -146,7 +146,7 @@
-