From 4d7fff7851c5c45ad191efe04b4fb424d0459c2a Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 28 Nov 2011 15:47:26 +0100 Subject: [PATCH] [FIX] move reload-webclient-on-module-install to act_window execution A special case reloads the Webclient if a dialog-included operation involving potential module installation (base.module.upgrade, or base.setup.installer) is involved. This was performed on an act_close, but it meant a module-involving act_window followed by a non-module-involving act_window (e.g. installation of a chart of account) did not match the check criteria and failed to trigger the reloading of the web client. Check moved to act_window execution, and augments the on_close handler bound to the dialog's closing any time a potential module installation (see above) is encountered, to ensure we don't "lose" cases, such as the installation of the `sales` application (from "add more features"), which was the issue in the related lp bug. lp bug: https://launchpad.net/bugs/887459 fixed bzr revid: xmo@openerp.com-20111128144726-aurpni1go73ezs6y --- addons/web/static/src/js/views.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 5a26ef58b03..582a526e57a 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -91,6 +91,14 @@ session.web.ActionManager = session.web.Widget.extend({ return this[type](action, on_close); }, ir_actions_act_window: function (action, on_close) { + if (_(['base.module.upgrade', 'base.setup.installer']) + .contains(action.res_model)) { + var old_close = on_close; + on_close = function () { + session.webclient.do_reload(); + if (old_close) { old_close(); } + }; + } if (action.target === 'new') { if (this.dialog == null) { this.dialog = new session.web.Dialog(this, { title: action.name, width: '80%' }); @@ -121,12 +129,6 @@ session.web.ActionManager = session.web.Widget.extend({ if (!this.dialog && on_closed) { on_closed(); } - if (this.dialog && action.context) { - var model = action.context.active_model; - if (model === 'base.module.upgrade' || model === 'base.setup.installer' || model === 'base.module.upgrade') { - session.webclient.do_reload(); - } - } this.dialog_stop(); }, ir_actions_server: function (action, on_closed) {