Commit c37b6f07 authored by Julien Muchembled's avatar Julien Muchembled

Do not initialize history for workflows that have no state at all

Since commit 38864 (hide worklist if for portal types that are not chained to
the workflow), we may want to create workflows that only contain worklists,
without polluting histories.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42116 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e53b354e
......@@ -308,21 +308,22 @@ def DCWorkflowDefinition_executeTransition(self, ob, tdef=None, kwargs=None):
validation_exc = None
# Figure out the old and new states.
old_sdef = self._getWorkflowStateOf(ob)
old_state = old_sdef.getId()
old_state = self._getWorkflowStateOf(ob, True)
if tdef is None:
new_state = self.initial_state
if not new_state:
# Do nothing if there is no initial state. We may want to create
# workflows with no state at all, only for worklists.
return
former_status = {}
else:
new_state = tdef.new_state_id
if not new_state:
# Stay in same state.
new_state = old_state
new_state = tdef.new_state_id or old_state
former_status = self._getStatusOf(ob)
new_sdef = self.states.get(new_state, None)
if new_sdef is None:
raise WorkflowException, (
'Destination state undefined: ' + new_state)
old_sdef = self.states[old_state]
try:
new_sdef = self.states[new_state]
except KeyError:
raise WorkflowException('Destination state undefined: ' + new_state)
# Execute the "before" script.
before_script_success = 1
......
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