Commit 02a20428 authored by Nicolas Delaby's avatar Nicolas Delaby

improve workflow_report

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22558 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ce711c13
...@@ -66,29 +66,58 @@ ...@@ -66,29 +66,58 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>listbox = []\n <value> <string>listbox = []\n
\n result_dict = {}\n
portal_workflow = context.portal_workflow\n portal_workflow = context.portal_workflow\n
content_type_list = context.allowedContentTypes()\n content_type_list = context.allowedContentTypes()\n
content_type_list.sort()\n
\n \n
# XXX better implementation is required, but I do not know how to get workflows related to a portal type\n # XXX better implementation is required, but I do not know how to get workflows related to a portal type\n
possible_state_name_list = ["validation_state", "simulation_state"]\n possible_state_name_list = (\'validation_state\',\n
\'simulation_state\',\n
\'causality_state\',\n
\'invoice_state\',\n
\'payment_state\',\n
\'event_state\',\n
\'opportunity_state\',\n
\'immobilisation_state\',)\n
\n \n
for content_type in content_type_list:\n for content_type in content_type_list:\n
content_type_id = content_type.id\n content_type_id = content_type.id\n
\n
for state_name in possible_state_name_list:\n for state_name in possible_state_name_list:\n
result_list = context.Base_zCountByWorkflowState(portal_type=content_type_id, state_name=state_name)\n result_list = context.Base_zCountByWorkflowState(portal_type=content_type_id,\n
\n state_name=state_name)\n
if not ((len(result_list) == 1) and (result_list[0][0] is None)):\n if not ((len(result_list) == 1) and (result_list[0][0] is None)):\n
for result in result_list:\n for result in result_list:\n
portal_type_dict = result_dict.get(content_type_id, {})\n
count = portal_type_dict.get(result[0], 0) + result[1]\n
portal_type_dict.update({result[0]: count})\n
result_dict.update({content_type_id: portal_type_dict})\n
\n \n
listbox.append({"portal_type":content_type_id,\n state_list_dict = {}\n
"state":result[0],\n for portal_type in result_dict.keys():\n
"count":result[1] })\n listbox.append({\'portal_type\': portal_type,\n
\'state\' : \'\',\n
\'count\' : \'\'})\n
state_list = result_dict[portal_type].keys()\n
state_list.sort()\n
for state in state_list:\n
count = state_list_dict.get(state, 0) + result_dict[portal_type][state]\n
state_list_dict.update({state:count})\n
listbox.append({\'portal_type\': \'\',\n
\'state\' : state,\n
\'count\' : result_dict[portal_type][state]})\n
\n \n
context.Base_updateDialogForm(listbox = listbox,\n listbox.append({\'portal_type\': \'All\',\n
empty_line_number = 0)\n \'state\' : \'\',\n
\'count\' : \'\'})\n
state_list = state_list_dict.keys()\n
state_list.sort()\n
for state in state_list:\n
listbox.append({\'portal_type\': \'\',\n
\'state\' : state,\n
\'count\' : state_list_dict[state]})\n
\n \n
context.Base_updateDialogForm(listbox=listbox, empty_line_number=0)\n
return context.Folder_viewWorkflowReport()\n return context.Folder_viewWorkflowReport()\n
</string> </value> </string> </value>
</item> </item>
...@@ -104,6 +133,12 @@ return context.Folder_viewWorkflowReport()\n ...@@ -104,6 +133,12 @@ return context.Folder_viewWorkflowReport()\n
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -141,6 +176,7 @@ return context.Folder_viewWorkflowReport()\n ...@@ -141,6 +176,7 @@ return context.Folder_viewWorkflowReport()\n
<value> <value>
<tuple> <tuple>
<string>listbox</string> <string>listbox</string>
<string>result_dict</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal_workflow</string> <string>portal_workflow</string>
...@@ -155,6 +191,12 @@ return context.Folder_viewWorkflowReport()\n ...@@ -155,6 +191,12 @@ return context.Folder_viewWorkflowReport()\n
<string>_getitem_</string> <string>_getitem_</string>
<string>None</string> <string>None</string>
<string>result</string> <string>result</string>
<string>portal_type_dict</string>
<string>count</string>
<string>state_list_dict</string>
<string>portal_type</string>
<string>state_list</string>
<string>state</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="ListBox" module="Products.ERP5Form.ListBox"/>
<string>Products.ERP5Form.ListBox</string> <tuple/>
<string>ListBox</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -325,10 +322,18 @@ ...@@ -325,10 +322,18 @@
<key> <string>alternate_name</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>anchor</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>columns</string> </key> <key> <string>columns</string> </key>
<value> <value>
<list> <list>
<tuple>
<string>portal_type</string>
<string>Portal Type</string>
</tuple>
<tuple> <tuple>
<string>state</string> <string>state</string>
<string>State</string> <string>State</string>
...@@ -379,12 +384,7 @@ ...@@ -379,12 +384,7 @@
<item> <item>
<key> <string>editable_columns</string> </key> <key> <string>editable_columns</string> </key>
<value> <value>
<list> <list/>
<tuple>
<string>None</string>
<string>None</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -425,6 +425,10 @@ ...@@ -425,6 +425,10 @@
<list/> <list/>
</value> </value>
</item> </item>
<item>
<key> <string>page_template</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>portal_types</string> </key> <key> <string>portal_types</string> </key>
<value> <value>
...@@ -457,7 +461,7 @@ ...@@ -457,7 +461,7 @@
</item> </item>
<item> <item>
<key> <string>selection_name</string> </key> <key> <string>selection_name</string> </key>
<value> <string></string> </value> <value> <string>folder_workflow_report_selection</string> </value>
</item> </item>
<item> <item>
<key> <string>sort</string> </key> <key> <string>sort</string> </key>
...@@ -474,12 +478,7 @@ ...@@ -474,12 +478,7 @@
<item> <item>
<key> <string>stat_columns</string> </key> <key> <string>stat_columns</string> </key>
<value> <value>
<list> <list/>
<tuple>
<string>None</string>
<string>None</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -505,11 +504,8 @@ ...@@ -505,11 +504,8 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Method" module="Products.Formulator.MethodField"/>
<string>Products.Formulator.MethodField</string> <tuple/>
<string>Method</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
......
877 878
\ No newline at end of file \ No newline at end of file
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