diff --git a/addons/payment/static/src/js/payment_form.js b/addons/payment/static/src/js/payment_form.js index 7c0a51d408f..049b7a55328 100644 --- a/addons/payment/static/src/js/payment_form.js +++ b/addons/payment/static/src/js/payment_form.js @@ -409,14 +409,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;