summaryrefslogtreecommitdiff
path: root/addons/payment/static
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-05-13 11:02:27 +0200
committerChristophe Simonis <chs@odoo.com>2019-05-13 11:02:27 +0200
commit60e71302a38b36214efec1213882f573e3ea453c (patch)
treed6c4f548ac29c94891a52444887a230a7c30d403 /addons/payment/static
parent3936d655c4bfd845b6ead724cecdc8e7c62816eb (diff)
parent243a4ae5cbc07027cd3eaf0ead036b9d3586dea3 (diff)
[MERGE] forward port branch saas-12.2 up to 243a4ae5cbc
Diffstat (limited to 'addons/payment/static')
-rw-r--r--addons/payment/static/src/js/payment_form.js26
1 files changed, 16 insertions, 10 deletions
diff --git a/addons/payment/static/src/js/payment_form.js b/addons/payment/static/src/js/payment_form.js
index c90b07875df..6036f946005 100644
--- a/addons/payment/static/src/js/payment_form.js
+++ b/addons/payment/static/src/js/payment_form.js
@@ -122,6 +122,18 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({
}
},
+ disableButton: function (button) {
+ $(button).attr('disabled', true);
+ $(button).children('.fa-lock').removeClass('fa-lock');
+ $(button).prepend('<span class="o_loader"><i class="fa fa-refresh fa-spin"></i>&nbsp;</span>');
+ },
+
+ enableButton: function (button) {
+ $(button).attr('disabled', false);
+ $(button).children('.fa').addClass('fa-lock');
+ $(button).find('span.o_loader').remove();
+ },
+
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
@@ -184,10 +196,7 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({
return;
}
- $(button).attr('disabled', true);
- $(button).children('.fa-plus-circle').removeClass('fa-plus-circle');
- $(button).prepend('<span class="o_loader"><i class="fa fa-refresh fa-spin"></i>&nbsp;</span>');
-
+ this.disableButton(button);
var verify_validity = this.$el.find('input[name="verify_validity"]');
if (verify_validity.length>0) {
@@ -225,14 +234,10 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({
}
}
// here we remove the 'processing' icon from the 'add a new payment' button
- $(button).attr('disabled', false);
- $(button).children('.fa').addClass('fa-plus-circle');
- $(button).find('span.o_loader').remove();
+ self.enableButton(button);
}).guardedCatch(function (error) {
// if the rpc fails, pretty obvious
- $(button).attr('disabled', false);
- $(button).children('.fa').addClass('fa-plus-circle');
- $(button).find('span.o_loader').remove();
+ self.enableButton(button);
self.displayError(
_t('Server Error'),
@@ -300,6 +305,7 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({
}
}
else { // if the user is using an old payment then we just submit the form
+ this.disableButton(button);
form.submit();
return new Promise(function () {});
}