summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/static/src/js/report/report.editor.js24
-rw-r--r--addons/web/static/src/js/report/report.js40
-rw-r--r--addons/web/views/report_templates.xml26
3 files changed, 54 insertions, 36 deletions
diff --git a/addons/web/static/src/js/report/report.editor.js b/addons/web/static/src/js/report/report.editor.js
index 15da9885e31..4955417a759 100644
--- a/addons/web/static/src/js/report/report.editor.js
+++ b/addons/web/static/src/js/report/report.editor.js
@@ -14,7 +14,6 @@ var trusted_origin = utils.build_origin(trusted_protocol, trusted_host);
// Patch the editor's behavior when it is launched inside an iframe.
if (window.self !== window.top) {
- $(document.body).addClass('o_in_iframe'); // in order to apply css rules
// And now we chain some deferred to `save` and `cancel` in order to inform
// the report's client action that the actions are done.
@@ -60,29 +59,6 @@ if (window.self !== window.top) {
}
}
}, false);
-
- // Allow to send commands to the webclient when the editor is disabled.
- if (window.location.search.indexOf('enable_editor') === -1) {
- // `do_action` command
- $('[res-id][res-model][view-type]')
- .wrap('<a/>')
- .attr('href', '#')
- .on('click', function (ev) {
- ev.preventDefault();
- var action = {
- 'type': 'ir.actions.act_window',
- 'view_type': $(this).attr('view-type'),
- 'view_mode': $(this).attr('view-mode') || $(this).attr('view-type'),
- 'res_id': Number($(this).attr('res-id')),
- 'res_model': $(this).attr('res-model'),
- 'views': [[$(this).attr('view-id') || false, $(this).attr('view-type')]],
- };
- window.parent.postMessage({
- 'message': 'report:do_action',
- 'action': action,
- }, trusted_origin);
- });
- }
}
options.registry.many2one.include({
diff --git a/addons/web/static/src/js/report/report.js b/addons/web/static/src/js/report/report.js
new file mode 100644
index 00000000000..50d78a9d151
--- /dev/null
+++ b/addons/web/static/src/js/report/report.js
@@ -0,0 +1,40 @@
+odoo.define('report', function (require) {
+'use strict';
+
+require('web.dom_ready');
+var utils = require('report.utils');
+
+if (window.self === window.top) {
+ return;
+}
+
+$(document.body).addClass('o_in_iframe'); // in order to apply css rules
+
+var web_base_url = $('html').attr('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);
+var trusted_origin = utils.build_origin(trusted_protocol, trusted_host);
+
+// Allow to send commands to the webclient when the editor is disabled.
+if (window.location.search.indexOf('enable_editor') === -1) {
+ // `do_action` command
+ $('[res-id][res-model][view-type]')
+ .wrap('<a/>')
+ .attr('href', '#')
+ .on('click', function (ev) {
+ ev.preventDefault();
+ var action = {
+ 'type': 'ir.actions.act_window',
+ 'view_type': $(this).attr('view-type'),
+ 'view_mode': $(this).attr('view-mode') || $(this).attr('view-type'),
+ 'res_id': Number($(this).attr('res-id')),
+ 'res_model': $(this).attr('res-model'),
+ 'views': [[$(this).attr('view-id') || false, $(this).attr('view-type')]],
+ };
+ window.parent.postMessage({
+ 'message': 'report:do_action',
+ 'action': action,
+ }, trusted_origin);
+ });
+}
+});
diff --git a/addons/web/views/report_templates.xml b/addons/web/views/report_templates.xml
index 6f83ae6254c..bc84d62a065 100644
--- a/addons/web/views/report_templates.xml
+++ b/addons/web/views/report_templates.xml
@@ -25,6 +25,12 @@
<link rel="stylesheet" type="text/scss" href="/web/static/src/scss/layout_background.scss"/>
<link rel="stylesheet" type="text/scss" href="/web/static/src/scss/layout_boxed.scss"/>
<link rel="stylesheet" type="text/scss" href="/web/static/src/scss/layout_clean.scss"/>
+
+ <script type="text/javascript" src="web/static/src/js/services/session.js"/>
+ <script type="text/javascript" src="/web/static/src/js/report/utils.js"/>
+ <script type="text/javascript" src="/web_editor/static/src/js/content/body_manager.js"/>
+ <script type="text/javascript" src="/web_editor/static/src/js/root_widget.js"/>
+ <script type="text/javascript" src='/web/static/src/js/report/report.js' />
</template>
<template id="report_assets_pdf">
@@ -37,7 +43,6 @@
<link rel="stylesheet" type="text/scss" href="/web/static/src/scss/report.editor.scss"/>
<script type="text/javascript" src="/web/static/src/js/services/session.js"/>
- <script type="text/javascript" src="/web/static/src/js/report/utils.js"/>
<script type="text/javascript" src='/web/static/src/js/report/report.editor.js' />
</template>
@@ -65,14 +70,13 @@
<t t-call-assets="web_editor.assets_editor" t-js="false"/>
<t t-call-assets="web.report_assets_editor" t-js="false"/>
</t>
+ <t t-call-assets="web.assets_common" t-css="false"/>
+ <t t-call-assets="web.report_assets_common" t-css="false"/>
<t t-if="editable">
- <t t-call-assets="web.assets_common" t-css="false"/>
<t t-call-assets="web_editor.summernote" t-css="false"/>
<t t-call-assets="web_editor.assets_editor" t-css="false"/>
<t t-call-assets="web.report_assets_editor" t-css="false"/>
- <script type="text/javascript" src="/web_editor/static/src/js/content/body_manager.js"/>
- <script type="text/javascript" src="/web_editor/static/src/js/root_widget.js"/>
<script type="text/javascript" src="/web_editor/static/src/js/iframe.js"></script>
<script t-if="enable_editor and inline_mode" type="text/javascript" src="/web_editor/static/src/js/inline.js"></script>
</t>
@@ -178,7 +182,7 @@
<div class="clearfix mb8"/>
</div>
- <div class="article o_report_layout_background" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id">
+ <div class="article o_report_layout_background">
<t t-call="web.address_layout"/>
<t t-raw="0"/>
</div>
@@ -218,7 +222,7 @@
</div>
</div>
- <div class="article o_report_layout_boxed" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id">
+ <div class="article o_report_layout_boxed">
<t t-call="web.address_layout"/>
<t t-raw="0"/>
</div>
@@ -257,7 +261,7 @@
</div>
</div>
- <div class="article o_report_layout_clean" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id">
+ <div class="article o_report_layout_clean">
<t t-call="web.address_layout"/>
<t t-raw="0"/>
</div>
@@ -305,7 +309,7 @@
</div>
</div>
- <div class="article o_report_layout_standard" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id">
+ <div class="article o_report_layout_standard">
<t t-call="web.address_layout"/>
<t t-raw="0"/>
</div>
@@ -386,16 +390,14 @@
</div>
</div>
</div>
- <div class="article" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id">
+ <div class="article">
<t t-raw="0"/>
</div>
</template>
<template id="basic_layout">
- <t t-if="not o" t-set="o" t-value="doc"/>
-
<t t-call="web.html_container">
- <div class="article" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id">
+ <div class="article">
<t t-raw="0"/>
</div>
</t>