diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-05-08 18:29:32 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-05-08 18:29:32 +0200 |
| commit | 825fee2626c6cd756283b4fa40876cd1d3d5357a (patch) | |
| tree | 9bc5d3dd31fc9557985899a34fbffb5661caafbd /addons/payment/static | |
| parent | 2c68df0ab43cb42e6762d7a1929471bf3f3df920 (diff) | |
| parent | d01db480872ea3705b3f0965beef79821b679acd (diff) | |
[MERGE] forward port branch 11.0 up to d01db480872
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 72aa70c88b6..c9dc2f50b60 100644 --- a/addons/payment/static/src/js/payment_form.js +++ b/addons/payment/static/src/js/payment_form.js @@ -30,6 +30,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; @@ -84,10 +96,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) { @@ -122,14 +131,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 (message, data) { // 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'), @@ -192,6 +197,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(); } } |
