diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-01-03 12:28:52 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-01-03 12:28:52 +0100 |
| commit | 362f0489d07d5bcd3673278e93848d0ea3d177a8 (patch) | |
| tree | ce164613ca633d736bf41c5b3d02b8ee541baa89 /addons/payment/static | |
| parent | a39491d459f7a70af21bce1f45434bab05f1c284 (diff) | |
| parent | fe22a0f9ca92ef0e76bb2f730a2b22da500db5dd (diff) | |
[MERGE] forward port branch 11.0 up to fe22a0f9ca9
Diffstat (limited to 'addons/payment/static')
| -rw-r--r-- | addons/payment/static/src/js/payment_form.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/addons/payment/static/src/js/payment_form.js b/addons/payment/static/src/js/payment_form.js index c65dc7cce57..5cfe9b1d88a 100644 --- a/addons/payment/static/src/js/payment_form.js +++ b/addons/payment/static/src/js/payment_form.js @@ -132,7 +132,7 @@ odoo.define('payment.payment_form', function (require) { // if there's a prepare tx url set if ($tx_url.length === 1) { // if the user wants to save his credit card info - var form_save_token = $('input[name="o_payment_form_save_token"]').checked === true; + var form_save_token = $('input[name="o_payment_form_save_token"]').prop('checked'); // then we call the route to prepare the transaction ajax.jsonRpc($tx_url[0].value, 'call', { 'acquirer_id': parseInt(acquirer_id), @@ -410,14 +410,18 @@ odoo.define('payment.payment_form', function (require) { }, }); - require('web.dom_ready'); // only start this when dom is ready - if (!$('.o_payment_form').length) { - return $.Deferred().reject("DOM doesn't contain '.o_payment_form'"); - } - $('.o_payment_form').each(function () { - var $elem = $(this); - var form = new PaymentForm(null, $elem.data()); - form.attachTo($elem); + $(function () { + // TODO move this to another module, requiring dom_ready and rejecting + // the returned deferred to get the proper message + if (!$('.o_payment_form').length) { + console.log("DOM doesn't contain '.o_payment_form'"); + return; + } + $('.o_payment_form').each(function () { + var $elem = $(this); + var form = new PaymentForm(null, $elem.data()); + form.attachTo($elem); + }); }); return PaymentForm; |
