Commit 297150fc authored by Eteri's avatar Eteri

Fix workflow bug "Local variable 'value' referenced before assignment"

See merge request !1704
parents b8e27caf 133118fc
......@@ -132,6 +132,22 @@ class TestERP5Workflow(ERP5TypeTestCase):
history = doc.workflow_history['wf']
self.assertEqual(len(history), 2)# create, transition1
transition_variable = transition1.newContent(
portal_type='Workflow Transition Variable',
causality_value=variable1,
variable_default_expression='string:Set by transition variable',
)
workflow._executeTransition(doc,transition1)
self.assertEqual(
workflow.getCurrentStatusDict(doc)['variable1'],
"Set by transition variable")
# Without an expression, the variable is set to None
transition_variable.setVariableDefaultExpression(None)
workflow._executeTransition(doc,transition1)
self.assertEqual(workflow.getCurrentStatusDict(doc)['variable1'], None)
def test_afterScript(self):
workflow = self.workflow_module.newContent(
......
......@@ -860,6 +860,7 @@ class Workflow(XMLObject):
continue
expr = None
value = None
if variable_id in transition_expression_dict:
expr = transition_expression_dict[variable_id]
elif not vdef.getAutomaticUpdate() and variable_reference in former_status:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment