details: https://code.tryton.org/tryton/commit/b6f38dae761b
branch: 7.0
user: Cédric Krier <[email protected]>
date: Tue Jun 16 13:41:49 2026 +0200
description:
Restore initial state when the execution of a wizard fails
Since 1aad63cbbba7 there is a check that the button from a wizard are
triggered
from the same state as they were created.
But when an exception is raised during the execution, the wizard must
be put
back to the initial state such that buttons can still be triggered
again.
Closes #14895
(grafted from 0eddec418366403871755be8ba3b750a9c0fcdf4)
diffstat:
sao/src/wizard.js | 15 +++++++--------
tryton/tryton/gui/window/wizard.py | 10 +++++-----
2 files changed, 12 insertions(+), 13 deletions(-)
diffs (99 lines):
diff -r 5fd1a903f47d -r b6f38dae761b sao/src/wizard.js
--- a/sao/src/wizard.js Thu Jun 11 15:30:11 2026 +0200
+++ b/sao/src/wizard.js Tue Jun 16 13:41:49 2026 +0200
@@ -42,19 +42,21 @@
'params': [this.session.context]
}, this.session).then(result => {
this.session_id = result[0];
- this.start_state = this.state = result[1];
+ this.start_state = result[1];
this.end_state = result[2];
- this.process();
+ this.process(this.start_state);
}, () => {
this.destroy();
});
},
- process: function() {
+ process: function(state) {
if (this.__processing || this.__waiting_response) {
return;
}
this.__processing = true;
var process = function() {
+ let current_state = this.state;
+ this.state = state;
if (this.state == this.end_state) {
this.end();
return;
@@ -116,6 +118,7 @@
this.state = this.end_state;
this.end();
}
+ this.state = current_state;
this.__processing = false;
});
};
@@ -151,8 +154,7 @@
return;
}
this.info_bar.clear();
- this.state = definition.state;
- this.process();
+ this.process(definition.state);
},
_get_button: function(definition) {
var style = 'btn-default';
@@ -394,9 +396,6 @@
hide: function() {
this.dialog.modal('hide');
},
- state_changed: function() {
- this.process();
- }
});
}());
diff -r 5fd1a903f47d -r b6f38dae761b tryton/tryton/gui/window/wizard.py
--- a/tryton/tryton/gui/window/wizard.py Thu Jun 11 15:30:11 2026 +0200
+++ b/tryton/tryton/gui/window/wizard.py Tue Jun 16 13:41:49 2026 +0200
@@ -71,11 +71,10 @@
self.destroy()
return
self.session_id, self.start_state, self.end_state = result
- self.state = self.start_state
- self.process()
+ self.process(self.start_state)
RPCExecute('wizard', action, 'create', callback=callback)
- def process(self):
+ def process(self, state):
from tryton.action import Action
if self.__processing or self.__waiting_response:
return
@@ -88,6 +87,7 @@
}
else:
data = {}
+ current_state, self.state = self.state, state
def callback(result):
try:
@@ -98,6 +98,7 @@
or not self.screen):
self.state = self.end_state
self.end()
+ self.state = current_state
self.__processing = False
return
@@ -178,8 +179,7 @@
self.screen.invalid_message(), Gtk.MessageType.ERROR)
return
self.info_bar_clear()
- self.state = state
- self.process()
+ self.process(state)
def _get_button(self, definition):
button = Button(definition)