details: https://code.tryton.org/tryton/commit/0eddec418366
branch: default
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
diffstat:
sao/src/wizard.js | 15 +++++++--------
tryton/tryton/gui/window/wizard.py | 10 +++++-----
2 files changed, 12 insertions(+), 13 deletions(-)
diffs (100 lines):
diff -r 599fb838e8d1 -r 0eddec418366 sao/src/wizard.js
--- a/sao/src/wizard.js Fri May 15 22:23:22 2026 +0200
+++ b/sao/src/wizard.js Tue Jun 16 13:41:49 2026 +0200
@@ -43,20 +43,22 @@
'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];
- return this.process();
+ return this.process(this.start_state);
}, () => {
this.destroy();
});
return this.__prm.promise();
},
- process: function() {
+ process: function(state) {
if (this.__processing || this.__waiting_response) {
return jQuery.when();
}
this.__processing = true;
var process = function() {
+ let current_state = this.state;
+ this.state = state;
if (this.state == this.end_state) {
return this.end();
}
@@ -121,6 +123,7 @@
this.state = this.end_state;
this.end();
}
+ this.state = current_state;
this.__processing = false;
});
};
@@ -158,8 +161,7 @@
return;
}
this.info_bar.clear();
- this.state = definition.state;
- this.process();
+ this.process(definition.state);
},
_get_button: function(definition) {
var style = 'btn-default';
@@ -401,9 +403,6 @@
hide: function() {
this.dialog.modal('hide');
},
- state_changed: function() {
- this.process();
- }
});
}());
diff -r 599fb838e8d1 -r 0eddec418366 tryton/tryton/gui/window/wizard.py
--- a/tryton/tryton/gui/window/wizard.py Fri May 15 22:23:22 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
@@ -179,8 +180,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)