summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/report/client_action.js
diff options
context:
space:
mode:
authorJulien Mougenot <jum@odoo.com>2020-03-11 09:38:28 +0000
committerJulien Mougenot <jum@odoo.com>2020-03-13 14:08:33 +0000
commit18e5416636b19b0953b1e6e26bfaeab1ebecce4c (patch)
tree5be75af26f1707a5b8b2184545719f3628d2980f /addons/web/static/src/js/report/client_action.js
parentfbf347498f1cc7b74ef373179b7bcae201715c24 (diff)
[REF] web: Adapt views/actions to new control panel
Some web actions/controllers/viewsl have been adapted to properly instantiate the newly refactored control panel and update it accordingly. We needed to adapt the starting mechanism of actions and controllers to ensure that the control panel instantiation did not delay the loading of any widget. Part of task 2196029 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/report/client_action.js')
-rw-r--r--addons/web/static/src/js/report/client_action.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/addons/web/static/src/js/report/client_action.js b/addons/web/static/src/js/report/client_action.js
index c8b5621e6de..9bd7c037d6e 100644
--- a/addons/web/static/src/js/report/client_action.js
+++ b/addons/web/static/src/js/report/client_action.js
@@ -37,7 +37,7 @@ var ReportAction = AbstractAction.extend({
start: function () {
var self = this;
this.iframe = this.$('iframe')[0];
- return Promise.all([this._super.apply(this, arguments), session.is_bound]).then(function () {
+ return Promise.all([this._super.apply(this, arguments), session.is_bound]).then(async function () {
var web_base_url = session['web.base.url'];
var trusted_host = utils.get_host_from_url(web_base_url);
var trusted_protocol = utils.get_protocol_from_url(web_base_url);
@@ -46,7 +46,11 @@ var ReportAction = AbstractAction.extend({
self.$buttons = $(QWeb.render('report.client_action.ControlButtons', {}));
self.$buttons.on('click', '.o_report_print', self.on_click_print);
- self._update_control_panel();
+ await self.updateControlPanel({
+ cp_content: {
+ $buttons: self.$buttons,
+ },
+ });
// Load the report in the iframe. Note that we use a relative URL.
self.iframe.src = self.report_url;
@@ -54,7 +58,11 @@ var ReportAction = AbstractAction.extend({
},
do_show: function () {
- this._update_control_panel();
+ this.updateControlPanel({
+ cp_content: {
+ $buttons: this.$buttons,
+ },
+ });
return this._super.apply(this, arguments);
},
@@ -69,14 +77,6 @@ var ReportAction = AbstractAction.extend({
$(window).off('message', this.on_message_received);
},
- _update_control_panel: function () {
- this.updateControlPanel({
- cp_content: {
- $buttons: this.$buttons,
- },
- });
- },
-
/**
* Event handler of the message post. We only handle them if they're from
* `web.base.url` host and protocol and if they're part of `AUTHORIZED_MESSAGES`.