diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-05-10 15:20:01 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-05-10 15:20:01 +0200 |
| commit | 243a4ae5cbc07027cd3eaf0ead036b9d3586dea3 (patch) | |
| tree | a7fc43164bf3926a6c30d63f9573e6f23fc2d20c /addons/payment/static | |
| parent | 9530f1071d816d76194ee57711192f709e4d4d19 (diff) | |
| parent | 330b99f60c0fcc09e2438a1958d11bf7e1383d8d (diff) | |
[MERGE] forward port branch saas-12.1 up to 330b99f60c0
Diffstat (limited to 'addons/payment/static')
| -rw-r--r-- | addons/payment/static/src/js/payment_form.js | 26 |
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 7494f50bf03..8c0d054c5df 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> </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> </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(); } |
