From 1a40e7b6c7956987f469fb7b2159f297c69ef537 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Fri, 24 Mar 2017 14:39:09 +0100 Subject: [PATCH] [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 62fb1bb92493b00bd45ed3f4eced5ca8b23f81d6. 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 --- addons/report/static/src/js/report.editor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/report/static/src/js/report.editor.js b/addons/report/static/src/js/report.editor.js index 5b58793bbf5..57942f9b79c 100644 --- a/addons/report/static/src/js/report.editor.js +++ b/addons/report/static/src/js/report.editor.js @@ -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