summaryrefslogtreecommitdiff
path: root/addons/web/static
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2020-03-18 15:57:08 +0000
committerAaron Bohy <aab@odoo.com>2020-03-18 16:07:16 +0000
commitf79f9c5133ec4d2346829995ad4abc0f621d0e12 (patch)
tree114abf437b3f7d2333ac4eed507643911be59a85 /addons/web/static
parentce77c64e63c6ab15246ccd816e925bb6732007df (diff)
[FIX] web: report client action: mount control panel
Before this commit, the 'mounted' hook of the control panel in the report client action was never called, because of a missing call to '_super'. As a consequence, the 'Print' button wasn't displayed. closes odoo/odoo#47940 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Diffstat (limited to 'addons/web/static')
-rw-r--r--addons/web/static/src/js/report/client_action.js16
-rw-r--r--addons/web/static/tests/chrome/action_manager_tests.js3
2 files changed, 9 insertions, 10 deletions
diff --git a/addons/web/static/src/js/report/client_action.js b/addons/web/static/src/js/report/client_action.js
index 9bd7c037d6e..9b7d1fb6124 100644
--- a/addons/web/static/src/js/report/client_action.js
+++ b/addons/web/static/src/js/report/client_action.js
@@ -37,21 +37,17 @@ var ReportAction = AbstractAction.extend({
start: function () {
var self = this;
this.iframe = this.$('iframe')[0];
+ this.$buttons = $(QWeb.render('report.client_action.ControlButtons', {}));
+ this.$buttons.on('click', '.o_report_print', this.on_click_print);
+ this.controlPanelProps.cp_content = {
+ $buttons: this.$buttons,
+ };
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);
self.trusted_origin = utils.build_origin(trusted_protocol, trusted_host);
- self.$buttons = $(QWeb.render('report.client_action.ControlButtons', {}));
- self.$buttons.on('click', '.o_report_print', self.on_click_print);
-
- 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;
});
@@ -71,10 +67,12 @@ var ReportAction = AbstractAction.extend({
// messages and we can only filter them by their origin, so we chose to ignore the
// messages that do not come from `web.base.url`.
$(window).on('message', this, this.on_message_received);
+ this._super();
},
on_detach_callback: function () {
$(window).off('message', this.on_message_received);
+ this._super();
},
/**
diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js
index 2c987215d43..3fd3598000a 100644
--- a/addons/web/static/tests/chrome/action_manager_tests.js
+++ b/addons/web/static/tests/chrome/action_manager_tests.js
@@ -2194,7 +2194,7 @@ QUnit.module('ActionManager', {
});
QUnit.test('should open the report client action if wkhtmltopdf is broken', async function (assert) {
- assert.expect(6);
+ assert.expect(7);
// patch the report client action to override its iframe's url so that
// it doesn't trigger an RPC when it is appended to the DOM (for this
@@ -2244,6 +2244,7 @@ QUnit.module('ActionManager', {
assert.containsOnce(actionManager, '.o_report_iframe',
"should have opened the report client action");
+ assert.containsOnce(actionManager, '.o_cp_buttons .o_report_buttons .o_report_print');
assert.verifySteps([
'/web/action/load',