From b3a3ad80991265c50f38fd20588df9a69b6bcf67 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 21 Sep 2018 09:25:52 +0000 Subject: [FIX] document: updateEnv->redraw on not form view In ac1e187ee some unecessary code and RPC were removed by ignoring attachments in the sidebar when they would never be shown. But there was an regression since `updateEnv` function would not longer call redraw (which is also called in _super function). report: https://github.com/odoo/odoo/commit/ac1e187eea3#r30569171 related to opw-1865736 closes #27146 --- addons/document/static/src/js/document.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'addons/document/static/src/js/document.js') diff --git a/addons/document/static/src/js/document.js b/addons/document/static/src/js/document.js index 98bfe4e5ef3..5c33a3f3cff 100644 --- a/addons/document/static/src/js/document.js +++ b/addons/document/static/src/js/document.js @@ -50,10 +50,9 @@ Sidebar.include({ * @override */ updateEnv: function (env) { - if (this.hasAttachments) { - this.env = env; - this._updateAttachments().then(this._redraw.bind(this)); - } + var _super = _.bind(this._super, this, env); + var def = this.hasAttachments ? this._updateAttachments() : $.when(); + def.then(_super); }, //-------------------------------------------------------------------------- -- cgit v1.2.3 From 2a697f1c5b06e741968dcd9b1f698ec5fc55f62e Mon Sep 17 00:00:00 2001 From: len-odoo Date: Thu, 27 Sep 2018 10:10:56 +0000 Subject: [FIX] document: update environment before attachments update Fine-tuning of commit: b3a3ad80991265c50f38fd20588df9a69b6bcf67 ac1e187eea33266095f49a9e1e1ea6b0698be865 The environment should be updated before the call to _updateAttachments, as it depends on the env active_id. opw 1888651 closes odoo/odoo#27277 --- addons/document/static/src/js/document.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/document/static/src/js/document.js') diff --git a/addons/document/static/src/js/document.js b/addons/document/static/src/js/document.js index 5c33a3f3cff..b8437d70417 100644 --- a/addons/document/static/src/js/document.js +++ b/addons/document/static/src/js/document.js @@ -50,6 +50,7 @@ Sidebar.include({ * @override */ updateEnv: function (env) { + this.env = env; var _super = _.bind(this._super, this, env); var def = this.hasAttachments ? this._updateAttachments() : $.when(); def.then(_super); -- cgit v1.2.3