summaryrefslogtreecommitdiff
path: root/addons/payment/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-05-09 11:12:22 +0200
committerChristophe Simonis <chs@odoo.com>2019-05-09 11:12:22 +0200
commitf1d6a6108e40569d4716cf45feb2b30cabf547bd (patch)
treeac33647690f7aaa2ad594987199a0183c6e786bc /addons/payment/static/src
parent6afec6b6b8d2a95264f1a775f8dcee9a90d3fda7 (diff)
parent825fee2626c6cd756283b4fa40876cd1d3d5357a (diff)
[MERGE] forward port branch saas-11.3 up to 825fee2626c
Diffstat (limited to 'addons/payment/static/src')
-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 8ccb48ec0de..97f49ddf2f2 100644
--- a/addons/payment/static/src/js/payment_form.js
+++ b/addons/payment/static/src/js/payment_form.js
@@ -36,6 +36,18 @@ odoo.define('payment.payment_form', function (require) {
$('[data-toggle="tooltip"]').tooltip();
},
+ 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();
+ },
+
payEvent: function (ev) {
ev.preventDefault();
var form = this.el;
@@ -90,10 +102,7 @@ odoo.define('payment.payment_form', function (require) {
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) {
@@ -128,14 +137,10 @@ odoo.define('payment.payment_form', function (require) {
}
}
// 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);
}).fail(function (error, event) {
// 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'),
@@ -200,6 +205,7 @@ odoo.define('payment.payment_form', function (require) {
}
}
else { // if the user is using an old payment then we just submit the form
+ this.disableButton(button);
form.submit();
return $.Deferred();
}