workflow fix (#5452)

* workflow fix

* add a line
This commit is contained in:
Suraj Shetty 2018-04-17 14:53:49 +05:30 committed by Rushabh Mehta
parent 5c824c1ee0
commit cb627cc7d6

View file

@ -110,7 +110,7 @@ def validate_workflow(doc):
current_state = doc._doc_before_save.get(workflow.workflow_state_field)
next_state = doc.get(workflow.workflow_state_field)
if not next_state:
if not next_state or not current_state:
# set default state (maybe not set in insert)
current_state = next_state = workflow.states[0].state
doc.set(workflow.workflow_state_field, workflow.states[0].state)