From fd8a1e0e87c34a6fb7aac095c983a323af4d12c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Tue, 26 Aug 2008 11:27:21 +0000 Subject: [PATCH] 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 --- .../Folder_generateWorkflowReport.xml | 36 +++++- .../Folder_generateWorkflowReportDialog.xml | 15 ++- .../your_format.xml | 107 ++++++++++++++++++ .../your_portal_skin.xml | 99 ++++++++++++++++ .../Folder_viewWorkflowReport/listbox.xml | 26 ++++- product/ERP5/bootstrap/erp5_core/bt/revision | 2 +- 6 files changed, 271 insertions(+), 14 deletions(-) create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog/your_format.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog/your_portal_skin.xml diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReport.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReport.xml index 5854ca55a8..e06d0c4efb 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReport.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReport.xml @@ -71,6 +71,8 @@ portal_workflow = context.portal_workflow\n content_type_list = context.allowedContentTypes()\n content_type_list.sort()\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 possible_state_name_list = (\'validation_state\',\n \'simulation_state\',\n @@ -93,30 +95,42 @@ for content_type in content_type_list:\n portal_type_dict.update({result[0]: count})\n result_dict.update({content_type_id: portal_type_dict})\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 portal_type_list = result_dict.keys()\n portal_type_list.sort()\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 \'count\' : \'\'})\n state_list = result_dict[portal_type].keys()\n state_list.sort()\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 state_list_dict.update({state:count})\n - listbox.append({\'portal_type\': \'\',\n - \'state\' : state,\n + listbox.append({\'translated_portal_type\': \'\',\n + \'state\' : state_title,\n \'count\' : result_dict[portal_type][state]})\n \n -listbox.append({\'portal_type\': \'All\',\n +listbox.append({\'translated_portal_type\': translateString(\'All\'),\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 + listbox.append({\'translated_portal_type\': \'\',\n + \'state\' : getStateTranslatedTitle(state, None),\n \'count\' : state_list_dict[state]})\n \n context.Base_updateDialogForm(listbox=listbox, empty_line_number=0)\n @@ -183,6 +197,7 @@ return context.Folder_viewWorkflowReport()\n <string>context</string> <string>portal_workflow</string> <string>content_type_list</string> + <string>translateString</string> <string>possible_state_name_list</string> <string>_getiter_</string> <string>content_type</string> @@ -195,11 +210,14 @@ return context.Folder_viewWorkflowReport()\n <string>result</string> <string>portal_type_dict</string> <string>count</string> + <string>dict</string> + <string>getStateTranslatedTitle</string> <string>state_list_dict</string> <string>portal_type_list</string> <string>portal_type</string> <string>state_list</string> <string>state</string> + <string>state_title</string> </tuple> </value> </item> @@ -218,6 +236,12 @@ return context.Folder_viewWorkflowReport()\n <key> <string>id</string> </key> <value> <string>Folder_generateWorkflowReport</string> </value> </item> + <item> + <key> <string>uid</string> </key> + <value> + <none/> + </value> + </item> <item> <key> <string>warnings</string> </key> <value> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog.xml index 11d3cb9a71..b0de6a6181 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog.xml @@ -36,6 +36,12 @@ </object> </value> </item> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> <item> <key> <string>action</string> </key> <value> <string>Folder_generateWorkflowReport</string> </value> @@ -52,7 +58,7 @@ <key> <string>group_list</string> </key> <value> <list> - <string>Default</string> + <string>left</string> </list> </value> </item> @@ -61,9 +67,12 @@ <value> <dictionary> <item> - <key> <string>Default</string> </key> + <key> <string>left</string> </key> <value> - <list/> + <list> + <string>your_format</string> + <string>your_portal_skin</string> + </list> </value> </item> </dictionary> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog/your_format.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog/your_format.xml new file mode 100644 index 0000000000..db51285160 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog/your_format.xml @@ -0,0 +1,107 @@ +<?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> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog/your_portal_skin.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog/your_portal_skin.xml new file mode 100644 index 0000000000..6e132ef4fb --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_generateWorkflowReportDialog/your_portal_skin.xml @@ -0,0 +1,99 @@ +<?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> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowReport/listbox.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowReport/listbox.xml index c53b47094d..232409e383 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowReport/listbox.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowReport/listbox.xml @@ -331,8 +331,8 @@ <value> <list> <tuple> - <string>portal_type</string> - <string>Portal Type</string> + <string>translated_portal_type</string> + <string>Type</string> </tuple> <tuple> <string>state</string> @@ -472,7 +472,12 @@ <item> <key> <string>sort_columns</string> </key> <value> - <list/> + <list> + <tuple> + <string>None</string> + <string>None</string> + </tuple> + </list> </value> </item> <item> @@ -492,7 +497,20 @@ <item> <key> <string>url_columns</string> </key> <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> </item> </dictionary> diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index 61721cab2a..90afd51b60 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -938 \ No newline at end of file +940 \ No newline at end of file -- 2.30.9