diff options
| author | qsm-odoo <qsm@odoo.com> | 2019-05-08 12:01:10 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2019-06-04 07:57:20 +0000 |
| commit | 4f750e705686617d48f73e93b87abeefb7fc87e2 (patch) | |
| tree | 977edbfbec34e1be54c257334a07cb2e55762eb8 /addons/payment/static/src | |
| parent | 91d68e296afe8de96f33303e3b74eb3482059f38 (diff) | |
[REF] *: handle inline scripts preparing for frontend JS lazy loading
* payment, im_livechat
Inline scripts using `odoo.define` cannot work anymore as the boot.js
file loading will be deferred.
Most of features which used an inline script should probably be entirely
refactored. This commit focuses on removing the inline scripts
with a minimal diff (or at least tried to).
Note: for the website livechat, the inline script was kept as it seems
to be a longer refactoring to get rid of it (even though it is clearly
possible). The inline script was however adapted to make sure it works
with lazy loaded JS in the frontend.
Part of https://github.com/odoo/odoo/pull/32181
task-1961045
Diffstat (limited to 'addons/payment/static/src')
| -rw-r--r-- | addons/payment/static/src/js/payment_processing.js | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/addons/payment/static/src/js/payment_processing.js b/addons/payment/static/src/js/payment_processing.js index 0fcfbc7ce81..4bad7fcb4ef 100644 --- a/addons/payment/static/src/js/payment_processing.js +++ b/addons/payment/static/src/js/payment_processing.js @@ -1,32 +1,22 @@ odoo.define('payment.processing', function (require) { 'use strict'; - var Widget = require('web.Widget'); - var Ajax = require('web.ajax'); - var Core = require('web.core'); - var Qweb = Core.qweb; - var _t = Core._t; + var publicWidget = require('web.public.widget'); + var ajax = require('web.ajax'); + var core = require('web.core'); + + var _t = core._t; $.blockUI.defaults.css.border = '0'; $.blockUI.defaults.css["background-color"] = ''; $.blockUI.defaults.overlayCSS["opacity"] = '0.9'; - return Widget.extend({ - /* Members */ - _payment_tx_ids: null, + publicWidget.registry.PaymentProcessing = publicWidget.Widget.extend({ + selector: '.o_payment_processing', + xmlDependencies: ['/payment/static/src/xml/payment_processing.xml'], + _pollCount: 0, - /* Events */ - events: { - }, - /* deps */ - xmlDependencies: ['/payment/static/src/xml/payment_processing.xml'], - /* Widget overrides */ - init: function (parent, payment_tx_ids) { - this._super.apply(this, arguments); - // - this._payment_tx_ids = payment_tx_ids; - }, start: function() { this.displayLoading(); this.poll(); @@ -48,7 +38,7 @@ odoo.define('payment.processing', function (require) { }, poll: function () { var self = this; - Ajax.jsonRpc('/payment/process/poll', 'call', {}).then(function(data) { + ajax.jsonRpc('/payment/process/poll', 'call', {}).then(function(data) { if(data.success === true) { self.processPolledData(data.transactions); } @@ -119,7 +109,7 @@ odoo.define('payment.processing', function (require) { this.displayContent("payment.display_tx_list", render_values); }, displayContent: function (xmlid, render_values) { - var html = Qweb.render(xmlid, render_values); + var html = core.qweb.render(xmlid, render_values); this.$el.find('.o_payment_processing_content').html(html); }, displayLoading: function () { |
