Commit ee15dfe2 authored by Julien Muchembled's avatar Julien Muchembled

erp5_core: small optimization of Base_getWorkflowHistorySectionList

- do not copy the result of Base_getWorkflowHistory, and only iterate on keys
- call getPhysicalPath only once
- get workflow tool only once, and without relying on acquisition
parent 90084370
...@@ -51,24 +51,20 @@ ...@@ -51,24 +51,20 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.ERP5Form.Report import ReportSection\n <value> <string>from Products.ERP5Form.Report import ReportSection\n
result = []\n path = context.getPhysicalPath()\n
\n portal_workflow = context.getPortalObject().portal_workflow\n
history_dict = context.Base_getWorkflowHistory()\n return [\n
for workflow_id, workflow_history in history_dict.items():\n
workflow_title = context.portal_workflow[workflow_id].title or workflow_id\n
result.append(\n
ReportSection(\n ReportSection(\n
path=context.getPhysicalPath(),\n form_id="Base_viewWorkflowHistory",\n
level=1,\n level=1,\n
form_id=\'Base_viewWorkflowHistory\',\n listbox_display_mode="FlatListMode",\n
selection_params={\'workflow_id\': workflow_id,\n path=path,\n
\'workflow_title\' : workflow_title},\n selection_params={\n
listbox_display_mode=\'FlatListMode\',\n "workflow_id": workflow_id,\n
temporary_selection=False,\n "workflow_title": portal_workflow[workflow_id].title or workflow_id},\n
)\n temporary_selection=False)\n
)\n for workflow_id in context.Base_getWorkflowHistory()\n
\n ]\n
return result\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
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