From b3d9647695065ea582e4a6b0603f3ebf9fde6976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Baranx=20=28bar=29?= Date: Thu, 19 Mar 2020 12:59:09 +0000 Subject: [IMP] web: use do_action instead of BBQ push_state on RedirectWarning In the RedirectWarning exception handler, it is better to use 'do_action()' instead of using a BBQ push_state() and then a location.reload(), to preserve the context and avoid losing menus and breadcrumbs for example. As the RedirectWarning receives only the action ID and not the full action, a new parameter has been added to be able to provide a context. This context is added in the 'additional_context' parameter of the do_action() TaskID: 2168071 --- addons/web/static/src/js/services/crash_manager.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/services/crash_manager.js b/addons/web/static/src/js/services/crash_manager.js index eee8d1b755d..19db73e1da5 100644 --- a/addons/web/static/src/js/services/crash_manager.js +++ b/addons/web/static/src/js/services/crash_manager.js @@ -357,17 +357,17 @@ var RedirectWarningHandler = Widget.extend(ExceptionHandler, { display: function() { var self = this; var error = this.error; + var additional_context = _.extend({}, this.context, error.data.arguments[3]); new WarningDialog(this, { title: _.str.capitalize(error.type) || _t("Odoo Warning"), buttons: [ {text: error.data.arguments[2], classes : "btn-primary", click: function() { - $.bbq.pushState({ - 'action': error.data.arguments[1], - 'cids': $.bbq.getState().cids, - }, 2); - self.destroy(); - location.reload(); + self.do_action( + error.data.arguments[1], + { + additional_context: additional_context, + }); }}, {text: _t("Cancel"), click: function() { self.destroy(); }, close: true} ] -- cgit v1.2.3