From 1ce4f15c39b7b242af61705850112cd85bc9febf Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 21 Dec 2017 16:33:32 +0100 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. note: 10.0 backport from 11.0 33aa89ed closes #20405 opw-786866 closes #21792 --- addons/web/static/src/js/action_manager.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/web/static/src/js/action_manager.js b/addons/web/static/src/js/action_manager.js index 974bfb982d7..e05ee1d0da4 100644 --- a/addons/web/static/src/js/action_manager.js +++ b/addons/web/static/src/js/action_manager.js @@ -385,6 +385,10 @@ var ActionManager = Widget.extend({ return this.inner_widget; }, history_back: function() { + if (this.dialog) { + this.dialog_stop(); + return; + } var nb_views = this.inner_action.get_nb_views(); if (nb_views > 1) { // Stay on this action, but select the previous view