[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) <jvm@odoo.com>
This commit is contained in:
jvm-odoo
2020-07-06 11:30:29 +00:00
parent 85c3fd8b73
commit 87aa189158
2 changed files with 2 additions and 1 deletions
@@ -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);
+1 -1
View File
@@ -146,7 +146,7 @@
</a>
</div>
<div class="float-right mt-2">
<button t-if="mode == 'payment'" id="o_payment_form_pay" type="submit" t-att-class="submit_class if submit_class else 'btn btn-primary btn-lg mb8 mt8'">
<button t-if="mode == 'payment'" id="o_payment_form_pay" type="submit" t-att-class="submit_class if submit_class else 'btn btn-primary btn-lg mb8 mt8'" disabled="true">
<t t-if="submit_txt">
<i t-if="icon_class and not icon_right" t-attf-class="fa {{icon_class}}"/>
<t t-esc="submit_txt"/>