details:   https://code.tryton.org/tryton/commit/86b3db529010
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Feb 05 18:21:05 2026 +0100
description:
        Switch the view when user cancel the new record

        Closes #14583
diffstat:

 sao/src/tab.js                   |  4 +++-
 tryton/tryton/gui/window/form.py |  3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 8429b0e8a3d8 -r 86b3db529010 sao/src/tab.js
--- a/sao/src/tab.js    Thu Feb 05 18:52:00 2026 +0100
+++ b/sao/src/tab.js    Thu Feb 05 18:21:05 2026 +0100
@@ -922,7 +922,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 -r 8429b0e8a3d8 -r 86b3db529010 tryton/tryton/gui/window/form.py
--- a/tryton/tryton/gui/window/form.py  Thu Feb 05 18:52:00 2026 +0100
+++ b/tryton/tryton/gui/window/form.py  Thu Feb 05 18:21:05 2026 +0100
@@ -322,7 +322,8 @@
         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()
 

Reply via email to