Commit ca50a17d authored by Rafael Monnerat's avatar Rafael Monnerat

ERP5: Recover corrupted workflow histories from migration bug

  The bug was already fixed on e57dd4fb

  This change is for Production instances where corruption occured only.
parent db13274f
...@@ -793,6 +793,18 @@ def WorkflowTool_setStatusOf(self, wf_id, ob, status): ...@@ -793,6 +793,18 @@ def WorkflowTool_setStatusOf(self, wf_id, ob, status):
if wfh is not None and not isinstance(wfh, NewWorkflowHistoryList): if wfh is not None and not isinstance(wfh, NewWorkflowHistoryList):
wfh = NewWorkflowHistoryList(wfh) wfh = NewWorkflowHistoryList(wfh)
ob.workflow_history[wf_id] = wfh ob.workflow_history[wf_id] = wfh
elif wfh is not None and isinstance(wfh, NewWorkflowHistoryList):
# Verify if the WorkflowHistory isn't corrupted due a bug on migration
# to NewWorkflowHistoryList class.
if wfh._prev is not None and wfh._next is None:
# If _next is None, we can still use _prev to reconstruct the list
# into its original form, and migrate.
# XXX This is nor entirely optimised but does the job as occurence
# is quite small
wfh = list(reversed(wfh))
wfh.reverse()
wfh = NewWorkflowHistoryList(wfh)
ob.workflow_history[wf_id] = wfh
if wfh is None: if wfh is None:
wfh = NewWorkflowHistoryList() wfh = NewWorkflowHistoryList()
if not has_history: if not has_history:
......
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