[FIX] report: allow to use Dialog API in report editor

When editing a report, the editor is launched in an iframe with an
environment which is different from backend and frontend. The problem
here is that the editor uses the `Dialog` API while the report editor
was not loading the associated xml file this API needs to work. Indeed,
when clicking on the "Discard" button for example, nothing seemed to
happen as a dialog was supposed to be opened.

This worked before as the editor was not using the `Dialog` API until
commit 62fb1bb924.
Unfortunatly, this commit adapted "iframe.js" to load the associated
xml file but forgot to adapt the report editor. In a future
amelioration, this "iframe.js" file could be added to the report editor
so that all "iframe editor" environement work properly with the same
adaptation code.

opw-724784
This commit is contained in:
qsm-odoo
2017-03-24 14:39:09 +01:00
parent b3934619d4
commit 1a40e7b6c7
@@ -1,6 +1,8 @@
odoo.define('report.editor', function (require) {
'use strict';
var ajax = require('web.ajax');
var core = require('web.core');
var utils = require('report.utils');
var editor = require('web_editor.editor');
var options = require('web_editor.snippets.options');
@@ -10,6 +12,8 @@ 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);
ajax.loadXML('/web/static/src/xml/base_common.xml', core.qweb);
// 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