From 16556a04ffb44edbce5b5b2e656c67bfbf88e544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Fri, 16 Mar 2018 18:27:20 +0100 Subject: [PATCH] Add wizard information to wizard context issue7143 review38011002 --- tryton/gui/window/wizard.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tryton/gui/window/wizard.py b/tryton/gui/window/wizard.py index 0c023e3828..8f5920f111 100644 --- a/tryton/gui/window/wizard.py +++ b/tryton/gui/window/wizard.py @@ -58,7 +58,11 @@ class Wizard(InfoBar): self.direct_print = direct_print self.email_print = email_print self.email = email - self.context = context + self.context = context.copy() if context is not None else {} + self.context['active_id'] = self.id + self.context['active_ids'] = self.ids + self.context['active_model'] = self.model + self.context['action_id'] = self.action_id def callback(result): try: @@ -78,10 +82,6 @@ class Wizard(InfoBar): self.__processing = True ctx = self.context.copy() - ctx['active_id'] = self.id - ctx['active_ids'] = self.ids - ctx['active_model'] = self.model - ctx['action_id'] = self.action_id if self.screen: data = { self.screen_state: self.screen.get_on_change_value(), @@ -119,7 +119,13 @@ class Wizard(InfoBar): ('email', self.email), ]: action[0].setdefault(k, v) - Action._exec_action(*action, context=self.context.copy()) + context = self.context.copy() + # Remove wizard keys added by run + del context['active_id'] + del context['active_ids'] + del context['active_model'] + del context['action_id'] + Action._exec_action(*action, context=context) if self.state == self.end_state: self.end(lambda *a: execute_actions())