Commit fd8a1e0e authored by Jérome Perrin's avatar Jérome Perrin

fix Folder_generateWorkflowReport, it was changing the portal type of temp...

fix Folder_generateWorkflowReport, it was changing the portal type of temp objects, so in the case of sale orders, some interaction workflows were triggered.
Add some missing translations and allow outputing this report in the preferred report style

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23161 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6f8fe0b4
...@@ -71,6 +71,8 @@ portal_workflow = context.portal_workflow\n ...@@ -71,6 +71,8 @@ portal_workflow = context.portal_workflow\n
content_type_list = context.allowedContentTypes()\n content_type_list = context.allowedContentTypes()\n
content_type_list.sort()\n content_type_list.sort()\n
\n \n
translateString = context.Base_translateString\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\',\n possible_state_name_list = (\'validation_state\',\n
\'simulation_state\',\n \'simulation_state\',\n
...@@ -93,30 +95,42 @@ for content_type in content_type_list:\n ...@@ -93,30 +95,42 @@ for content_type in content_type_list:\n
portal_type_dict.update({result[0]: count})\n portal_type_dict.update({result[0]: count})\n
result_dict.update({content_type_id: portal_type_dict})\n result_dict.update({content_type_id: portal_type_dict})\n
\n \n
\n
def getStateTranslatedTitle(state, portal_type, saved_state_dict=dict()):\n
if state in saved_state_dict:\n
return saved_state_dict[state]\n
# XXX requires manager proxy role\n
workflow_for_ptype = portal_workflow.getWorkflowsFor(portal_type)\n
for workflow in workflow_for_ptype:\n
if hasattr(workflow, \'states\') and state in workflow.states.objectIds():\n
saved_state_dict[state] = translateString(getattr(workflow.states, state).title_or_id())\n
return saved_state_dict[state]\n
\n
state_list_dict = {}\n state_list_dict = {}\n
portal_type_list = result_dict.keys()\n portal_type_list = result_dict.keys()\n
portal_type_list.sort()\n portal_type_list.sort()\n
for portal_type in portal_type_list:\n for portal_type in portal_type_list:\n
listbox.append({\'portal_type\': portal_type,\n listbox.append({\'translated_portal_type\': translateString(portal_type),\n
\'state\' : \'\',\n \'state\' : \'\',\n
\'count\' : \'\'})\n \'count\' : \'\'})\n
state_list = result_dict[portal_type].keys()\n state_list = result_dict[portal_type].keys()\n
state_list.sort()\n state_list.sort()\n
for state in state_list:\n for state in state_list:\n
state_title = getStateTranslatedTitle(state, portal_type)\n
count = state_list_dict.get(state, 0) + result_dict[portal_type][state]\n count = state_list_dict.get(state, 0) + result_dict[portal_type][state]\n
state_list_dict.update({state:count})\n state_list_dict.update({state:count})\n
listbox.append({\'portal_type\': \'\',\n listbox.append({\'translated_portal_type\': \'\',\n
\'state\' : state,\n \'state\' : state_title,\n
\'count\' : result_dict[portal_type][state]})\n \'count\' : result_dict[portal_type][state]})\n
\n \n
listbox.append({\'portal_type\': \'All\',\n listbox.append({\'translated_portal_type\': translateString(\'All\'),\n
\'state\' : \'\',\n \'state\' : \'\',\n
\'count\' : \'\'})\n \'count\' : \'\'})\n
state_list = state_list_dict.keys()\n state_list = state_list_dict.keys()\n
state_list.sort()\n state_list.sort()\n
for state in state_list:\n for state in state_list:\n
listbox.append({\'portal_type\': \'\',\n listbox.append({\'translated_portal_type\': \'\',\n
\'state\' : state,\n \'state\' : getStateTranslatedTitle(state, None),\n
\'count\' : state_list_dict[state]})\n \'count\' : state_list_dict[state]})\n
\n \n
context.Base_updateDialogForm(listbox=listbox, empty_line_number=0)\n context.Base_updateDialogForm(listbox=listbox, empty_line_number=0)\n
...@@ -183,6 +197,7 @@ return context.Folder_viewWorkflowReport()\n ...@@ -183,6 +197,7 @@ return context.Folder_viewWorkflowReport()\n
<string>context</string> <string>context</string>
<string>portal_workflow</string> <string>portal_workflow</string>
<string>content_type_list</string> <string>content_type_list</string>
<string>translateString</string>
<string>possible_state_name_list</string> <string>possible_state_name_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>content_type</string> <string>content_type</string>
...@@ -195,11 +210,14 @@ return context.Folder_viewWorkflowReport()\n ...@@ -195,11 +210,14 @@ return context.Folder_viewWorkflowReport()\n
<string>result</string> <string>result</string>
<string>portal_type_dict</string> <string>portal_type_dict</string>
<string>count</string> <string>count</string>
<string>dict</string>
<string>getStateTranslatedTitle</string>
<string>state_list_dict</string> <string>state_list_dict</string>
<string>portal_type_list</string> <string>portal_type_list</string>
<string>portal_type</string> <string>portal_type</string>
<string>state_list</string> <string>state_list</string>
<string>state</string> <string>state</string>
<string>state_title</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -218,6 +236,12 @@ return context.Folder_viewWorkflowReport()\n ...@@ -218,6 +236,12 @@ return context.Folder_viewWorkflowReport()\n
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Folder_generateWorkflowReport</string> </value> <value> <string>Folder_generateWorkflowReport</string> </value>
</item> </item>
<item>
<key> <string>uid</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
<value> <value>
......
...@@ -36,6 +36,12 @@ ...@@ -36,6 +36,12 @@
</object> </object>
</value> </value>
</item> </item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>Folder_generateWorkflowReport</string> </value> <value> <string>Folder_generateWorkflowReport</string> </value>
...@@ -52,7 +58,7 @@ ...@@ -52,7 +58,7 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<list> <list>
<string>Default</string> <string>left</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -61,9 +67,12 @@ ...@@ -61,9 +67,12 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>Default</string> </key> <key> <string>left</string> </key>
<value> <value>
<list/> <list>
<string>your_format</string>
<string>your_portal_skin</string>
</list>
</value> </value>
</item> </item>
</dictionary> </dictionary>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_format</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>Printing format</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_format</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Format</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_portal_skin</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>your_portal_skin</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewDialogFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -331,8 +331,8 @@ ...@@ -331,8 +331,8 @@
<value> <value>
<list> <list>
<tuple> <tuple>
<string>portal_type</string> <string>translated_portal_type</string>
<string>Portal Type</string> <string>Type</string>
</tuple> </tuple>
<tuple> <tuple>
<string>state</string> <string>state</string>
...@@ -472,7 +472,12 @@ ...@@ -472,7 +472,12 @@
<item> <item>
<key> <string>sort_columns</string> </key> <key> <string>sort_columns</string> </key>
<value> <value>
<list/> <list>
<tuple>
<string>None</string>
<string>None</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -492,7 +497,20 @@ ...@@ -492,7 +497,20 @@
<item> <item>
<key> <string>url_columns</string> </key> <key> <string>url_columns</string> </key>
<value> <value>
<list/> <list>
<tuple>
<string>translated_portal_type</string>
<string></string>
</tuple>
<tuple>
<string>state</string>
<string></string>
</tuple>
<tuple>
<string>count</string>
<string></string>
</tuple>
</list>
</value> </value>
</item> </item>
</dictionary> </dictionary>
......
938 940
\ 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