diff --git a/sao/src/wizard.js b/sao/src/wizard.js index 5a2971d45f..aa43fd55ce 100644 --- a/sao/src/wizard.js +++ b/sao/src/wizard.js @@ -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 --git a/tryton/tryton/gui/window/wizard.py b/tryton/tryton/gui/window/wizard.py index dce983d666..747a82e2c7 100644 --- a/tryton/tryton/gui/window/wizard.py +++ b/tryton/tryton/gui/window/wizard.py @@ -71,11 +71,10 @@ class Wizard(InfoBar): 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 @@ class Wizard(InfoBar): } else: data = {} + current_state, self.state = self.state, state def callback(result): try: @@ -98,6 +98,7 @@ class Wizard(InfoBar): or not self.screen): self.state = self.end_state self.end() + self.state = current_state self.__processing = False return @@ -179,8 +180,7 @@ class Wizard(InfoBar): 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)