From b6c3ee4e24ffefe6de326bb94861226c176a5bd9 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 8b88ee0c54f..aa5572f5e7d 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