diff options
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/core/dom.js | 11 | ||||
| -rw-r--r-- | addons/web/static/src/js/report/report.editor.js | 41 | ||||
| -rw-r--r-- | addons/web/static/src/less/report.editor.less | 2 |
3 files changed, 30 insertions, 24 deletions
diff --git a/addons/web/static/src/js/core/dom.js b/addons/web/static/src/js/core/dom.js index 8ad094b0ae8..6650022c486 100644 --- a/addons/web/static/src/js/core/dom.js +++ b/addons/web/static/src/js/core/dom.js @@ -1,3 +1,13 @@ +odoo.define('web.dom_ready', function (require) { +'use strict'; + +var def = $.Deferred(); +$(def.resolve.bind(def)); +return def; +}); + +//============================================================================== + odoo.define('web.dom', function (require) { "use strict"; @@ -245,5 +255,4 @@ return { return $container; }, }; - }); diff --git a/addons/web/static/src/js/report/report.editor.js b/addons/web/static/src/js/report/report.editor.js index a36b1596ca2..0059e39be02 100644 --- a/addons/web/static/src/js/report/report.editor.js +++ b/addons/web/static/src/js/report/report.editor.js @@ -1,7 +1,6 @@ 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'); @@ -16,23 +15,18 @@ var trusted_origin = utils.build_origin(trusted_protocol, trusted_host); if (window.self !== window.top) { $(document.body).addClass('o_in_iframe'); // in order to apply css rules - // As `reload` is called after `save` and `cancel`, we nullify this function - // if the editor in order to be able to chain some deferred to `save` and - // `cancel`. - editor.reload = function () { - return $.when(); - }; - // And now we chain some deferred to `save` and `cancel` in order to inform // the report's client action that the actions are done. editor.Class.include({ save: function () { - return this._super.apply(this, arguments).then(function () { + // Force to not reload + return this._super(false).then(function () { window.parent.postMessage('report.editor:save_ok', trusted_origin); }); }, cancel: function () { - return this._super.apply(this, arguments).then(function () { + // Force to not reload + return this._super(false).then(function () { window.parent.postMessage('report.editor:discard_ok', trusted_origin); }); }, @@ -54,12 +48,12 @@ if (window.self !== window.top) { return; } - switch(message) { + switch (message) { case 'report.editor:ask_save': - editor.editor_bar.save(); + core.bus.trigger('editor_save_request'); break; case 'report.editor:ask_discard': - editor.editor_bar.cancel(); + core.bus.trigger('editor_discard_request'); break; default: } @@ -91,16 +85,19 @@ if (window.self !== window.top) { } options.registry.many2one.include({ - select_record: function (li) { - var self = this; - this._super(li); - if (this.$target.data('oe-field') === "partner_id") { - var $img = $('.header .row img:first'); - var css = window.getComputedStyle($img[0]); - $img.css("max-height", css.height+'px'); - $img.attr("src", "/web/image/res.partner/"+self.ID+"/image"); - setTimeout(function () { $img.removeClass('o_dirty'); },0); + _selectRecord: function ($li) { + this._super.apply(this, arguments); + if (this.$target.data('oe-field') !== 'partner_id') { + return; } + + var $img = $('.header .row img:first'); + var css = window.getComputedStyle($img[0]); + $img.css('max-height', css.height+'px'); + $img.attr('src', '/web/image/res.partner/' + this.ID + '/image'); + _.defer(function () { + $img.removeClass('o_dirty'); + }); } }); diff --git a/addons/web/static/src/less/report.editor.less b/addons/web/static/src/less/report.editor.less index 206ddb87037..544787ff6b2 100644 --- a/addons/web/static/src/less/report.editor.less +++ b/addons/web/static/src/less/report.editor.less @@ -14,7 +14,7 @@ body.o_in_iframe { margin-top: 40px!important; - div.o_css_editor { + div#web_editor-top-edit { > form { display: none; } |
