diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-05-09 21:07:44 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-05-09 21:07:44 +0200 |
| commit | cc3a2c1bf3c8aa2a7f85b5c2f8eb4e9415f3e6c7 (patch) | |
| tree | f97b6171e54f052126a1fad2f55a33c603e18bef /addons/payment/static | |
| parent | 92cb648882082cc8d84d3bbe75304def5196998c (diff) | |
| parent | e11bacfe512a3170f44d6d43646af914a9cf3b73 (diff) | |
[MERGE] forward port branch 12.0 up to e11bacfe512
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 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> </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(); } |
