Commit c33ac428 authored by iv's avatar iv

ERP5Workflow: fix history listing and remove old compatibility code.

parent bc6ae22b
...@@ -9,7 +9,6 @@ can_view_history = getSecurityManager().getUser().has_permission('View History', ...@@ -9,7 +9,6 @@ can_view_history = getSecurityManager().getUser().has_permission('View History',
marker = [] marker = []
result = [] result = []
i = 1
portal_object = context.getPortalObject() portal_object = context.getPortalObject()
portal_workflow = portal_object.portal_workflow portal_workflow = portal_object.portal_workflow
workflow_id_list = [x for x, y in context.getWorkflowStateItemList()] workflow_id_list = [x for x, y in context.getWorkflowStateItemList()]
...@@ -29,25 +28,20 @@ def getActorName(actor): ...@@ -29,25 +28,20 @@ def getActorName(actor):
return actor_name_cache[actor] return actor_name_cache[actor]
# Get history # Get history
# XXX Compatibility workflow_item_list = portal_workflow.getInfoFor(ob=context, name='history',
wf_id=workflow_id)
workflow = getattr(portal_workflow, workflow_id) workflow = getattr(portal_workflow, workflow_id)
wf_state_variable = workflow.getStateVariable() wf_state_variable = workflow.getStateVariable()
next_serial = None next_serial = None
previous_obj = None previous_obj = None
for workflow_item in portal_workflow.getInfoFor(ob=context, name='history', for position, workflow_item in enumerate(workflow_item_list):
wf_id=workflow_id)
# XXX removing str method generate a strange bug # XXX removing str method generate a strange bug
current_object = newTempBase(portal_object, str(i)) current_object = newTempBase(portal_object, str(position + 1))
i += 1
for key, value in workflow_item.items(): for key, value in workflow_item.items():
if key == 'serial' and not can_view_history: if key == 'serial' and not can_view_history:
continue continue
# XXX Compatibility
for compatibility_name in ['building_', 'installation_']:
if key.startswith(compatibility_name):
# Display the workflow state in the state columns
key = key[len(compatibility_name):]
if key == wf_state_variable: if key == wf_state_variable:
state = workflow.getStateValueById(value) state = workflow.getStateValueById(value)
# Store locally the id of state, usefull for merging action and transition # Store locally the id of state, usefull for merging action and transition
......
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