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',
marker = []
result = []
i = 1
portal_object = context.getPortalObject()
portal_workflow = portal_object.portal_workflow
workflow_id_list = [x for x, y in context.getWorkflowStateItemList()]
......@@ -29,25 +28,20 @@ def getActorName(actor):
return actor_name_cache[actor]
# Get history
# XXX Compatibility
workflow_item_list = portal_workflow.getInfoFor(ob=context, name='history',
wf_id=workflow_id)
workflow = getattr(portal_workflow, workflow_id)
wf_state_variable = workflow.getStateVariable()
next_serial = None
previous_obj = None
for workflow_item in portal_workflow.getInfoFor(ob=context, name='history',
wf_id=workflow_id)
for position, workflow_item in enumerate(workflow_item_list):
# XXX removing str method generate a strange bug
current_object = newTempBase(portal_object, str(i))
i += 1
current_object = newTempBase(portal_object, str(position + 1))
for key, value in workflow_item.items():
if key == 'serial' and not can_view_history:
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:
state = workflow.getStateValueById(value)
# 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