From 5c3be297b93b080bc475cf10f1ae325abb785c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 5 Feb 2026 18:21:05 +0100 Subject: [PATCH] Switch the view when user cancel the new record Closes #14583 (grafted from 86b3db529010f8fa36dfee4949f160f77298efc3) --HG-- branch : 7.0 --- sao/src/tab.js | 4 +++- tryton/tryton/gui/window/form.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sao/src/tab.js b/sao/src/tab.js index 0d546ac704..021851bfdc 100644 --- a/sao/src/tab.js +++ b/sao/src/tab.js @@ -856,7 +856,9 @@ }); }, switch_: function() { - return this.modified_save().then(() => this.screen.switch_view()); + return this.modified_save().then( + () => this.screen.switch_view(), + (result) => result ? this.screen.switch_view() : null); }, reload: function(test_modified=true) { const reload = () => { diff --git a/tryton/tryton/gui/window/form.py b/tryton/tryton/gui/window/form.py index f92bd57386..0df35bc114 100644 --- a/tryton/tryton/gui/window/form.py +++ b/tryton/tryton/gui/window/form.py @@ -292,7 +292,8 @@ class Form(TabContent): update('note', label, 'tryton-note', badge) def sig_switch(self, widget=None): - if not self.modified_save(): + result = self.modified_save() + if not result and result is not None: return self.screen.switch_view()