From 33aa89ed05b8e011e47c67cf73d545b334a7034b Mon Sep 17 00:00:00 2001 From: Khoi Nguyen Date: Fri, 29 Sep 2017 14:54:48 +0200 Subject: [PATCH] [FIX] web: discarding a new record in a modal closes the modal Discarding a new record triggers the 'history_back' action. This makes sense if the record was discarded from a normal form view, but not so much when in a modal, where the expected behaviour is to close the dialog. This commit overrides the function in the action manager which handles the switch to the previous view. It checks whether a dialog window is open, in which case it simply closes it. --- addons/web/static/src/js/chrome/action_manager.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/web/static/src/js/chrome/action_manager.js b/addons/web/static/src/js/chrome/action_manager.js index 194b8e6c8a7..25ee9c20cf6 100644 --- a/addons/web/static/src/js/chrome/action_manager.js +++ b/addons/web/static/src/js/chrome/action_manager.js @@ -420,6 +420,10 @@ var ActionManager = Widget.extend({ return this.inner_widget; }, history_back: function() { + if (this.dialog) { + this.dialog.close(); + return; + } var nbViews = this.inner_action.get_nb_views(); if (nbViews > 1) { // Stay on this action, but select the previous view