Commit 8f8d9a45 authored by Sebastien Robin's avatar Sebastien Robin

improved scripts wich are looking at remaining operations at the end of a working day

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12110 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e9b5e88c
...@@ -116,6 +116,12 @@ ...@@ -116,6 +116,12 @@
<name>Add Cookie Crumblers</name> <name>Add Cookie Crumblers</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Add Database Methods</name> <name>Add Database Methods</name>
<role>Manager</role> <role>Manager</role>
...@@ -351,6 +357,9 @@ ...@@ -351,6 +357,9 @@
<name>Change Browser Id Manager</name> <name>Change Browser Id Manager</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Change DTML Documents</name> <name>Change DTML Documents</name>
<role>Manager</role> <role>Manager</role>
...@@ -494,6 +503,9 @@ ...@@ -494,6 +503,9 @@
<permission type='list'> <permission type='list'>
<name>Edit target</name> <name>Edit target</name>
</permission> </permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>FTP access</name> <name>FTP access</name>
<role>Manager</role> <role>Manager</role>
......
...@@ -119,6 +119,12 @@ ...@@ -119,6 +119,12 @@
<name>Add Cookie Crumblers</name> <name>Add Cookie Crumblers</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Add Database Methods</name> <name>Add Database Methods</name>
<role>Manager</role> <role>Manager</role>
...@@ -353,6 +359,9 @@ ...@@ -353,6 +359,9 @@
<name>Change Browser Id Manager</name> <name>Change Browser Id Manager</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Change DTML Documents</name> <name>Change DTML Documents</name>
<role>Manager</role> <role>Manager</role>
...@@ -496,6 +505,9 @@ ...@@ -496,6 +505,9 @@
<permission type='list'> <permission type='list'>
<name>Edit target</name> <name>Edit target</name>
</permission> </permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>FTP access</name> <name>FTP access</name>
<role>Manager</role> <role>Manager</role>
......
...@@ -110,6 +110,12 @@ ...@@ -110,6 +110,12 @@
<name>Add Cookie Crumblers</name> <name>Add Cookie Crumblers</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Add Database Methods</name> <name>Add Database Methods</name>
<role>Manager</role> <role>Manager</role>
...@@ -343,6 +349,9 @@ ...@@ -343,6 +349,9 @@
<name>Change Browser Id Manager</name> <name>Change Browser Id Manager</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Change DTML Documents</name> <name>Change DTML Documents</name>
<role>Manager</role> <role>Manager</role>
...@@ -485,6 +494,9 @@ ...@@ -485,6 +494,9 @@
<permission type='list'> <permission type='list'>
<name>Edit target</name> <name>Edit target</name>
</permission> </permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>FTP access</name> <name>FTP access</name>
<role>Manager</role> <role>Manager</role>
......
...@@ -117,6 +117,12 @@ ...@@ -117,6 +117,12 @@
<name>Add Cookie Crumblers</name> <name>Add Cookie Crumblers</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Add Database Methods</name> <name>Add Database Methods</name>
<role>Manager</role> <role>Manager</role>
...@@ -351,6 +357,9 @@ ...@@ -351,6 +357,9 @@
<name>Change Browser Id Manager</name> <name>Change Browser Id Manager</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Change DTML Documents</name> <name>Change DTML Documents</name>
<role>Manager</role> <role>Manager</role>
...@@ -494,6 +503,9 @@ ...@@ -494,6 +503,9 @@
<permission type='list'> <permission type='list'>
<name>Edit target</name> <name>Edit target</name>
</permission> </permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>FTP access</name> <name>FTP access</name>
<role>Manager</role> <role>Manager</role>
......
...@@ -117,6 +117,12 @@ ...@@ -117,6 +117,12 @@
<name>Add Cookie Crumblers</name> <name>Add Cookie Crumblers</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Add Database Methods</name> <name>Add Database Methods</name>
<role>Manager</role> <role>Manager</role>
...@@ -351,6 +357,9 @@ ...@@ -351,6 +357,9 @@
<name>Change Browser Id Manager</name> <name>Change Browser Id Manager</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Change DTML Documents</name> <name>Change DTML Documents</name>
<role>Manager</role> <role>Manager</role>
...@@ -494,6 +503,9 @@ ...@@ -494,6 +503,9 @@
<permission type='list'> <permission type='list'>
<name>Edit target</name> <name>Edit target</name>
</permission> </permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>FTP access</name> <name>FTP access</name>
<role>Manager</role> <role>Manager</role>
......
...@@ -117,6 +117,12 @@ ...@@ -117,6 +117,12 @@
<name>Add Cookie Crumblers</name> <name>Add Cookie Crumblers</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Add Database Methods</name> <name>Add Database Methods</name>
<role>Manager</role> <role>Manager</role>
...@@ -351,6 +357,9 @@ ...@@ -351,6 +357,9 @@
<name>Change Browser Id Manager</name> <name>Change Browser Id Manager</name>
<role>Manager</role> <role>Manager</role>
</permission> </permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>Change DTML Documents</name> <name>Change DTML Documents</name>
<role>Manager</role> <role>Manager</role>
...@@ -494,6 +503,9 @@ ...@@ -494,6 +503,9 @@
<permission type='list'> <permission type='list'>
<name>Edit target</name> <name>Edit target</name>
</permission> </permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'> <permission type='tuple'>
<name>FTP access</name> <name>FTP access</name>
<role>Manager</role> <role>Manager</role>
......
...@@ -71,32 +71,14 @@ ...@@ -71,32 +71,14 @@
<value> <string># Make sure there is not any operation wich is not finished yet\n <value> <string># Make sure there is not any operation wich is not finished yet\n
# This is usefull when we close a counter date\n # This is usefull when we close a counter date\n
\n \n
not_closed_state_list = (\'ordered\',\'planned\',\'confirmed\',\'started\',\'stopped\')\n document_list = context.CounterDate_getRemainingOperationList(site=site)\n
if site is None:\n \n
root_site_url = context.Baobab_getUserAssignedRootSiteList()[0]\n \n
site = context.portal_categories.restrictedTraverse(root_site_url)\n
root_site_uid = site.getUid()\n
portal_type_list = [x for x in context.getPortalDeliveryTypeList() if x!=\'Cash Movement\']\n
document_list = context.Baobab_getRemainingOperationList(site_uid=root_site_uid,\n
simulation_state=not_closed_state_list,\n
portal_type = portal_type_list)\n
#document_list = [x.getObject() for x in context.portal_catalog(\n
# simulation_state=not_closed_state_list,\n
# default_source_uid=root_site_uid,\n
# portal_type=portal_type_list)]\n
#document_list.extend([x.getObject() for x in context.portal_catalog(\n
# simulation_state=not_closed_state_list,\n
# default_destination_uid=root_site_uid,\n
# portal_type=portal_type_list)])\n
for document in document_list:\n for document in document_list:\n
# Cash movement in ordered stated are allowed\n
if document.getPortalType() in (\'Cash Movement\',):\n
if document.getSimulationState()==\'planned\':\n
continue\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
portal_type = document.getTranslatedPortalType()\n portal_type = document.getTranslatedPortalType()\n
reference = document.getReference()\n reference = document.getSourceReference()\n
if reference is None:\n if reference is None:\n
reference = Message(domain=\'ui\',message=\'Not defined\')\n reference = Message(domain=\'ui\',message=\'Not defined\')\n
message = Message(domain="ui", \n message = Message(domain="ui", \n
...@@ -152,19 +134,10 @@ for document in document_list:\n ...@@ -152,19 +134,10 @@ for document in document_list:\n
<value> <value>
<tuple> <tuple>
<string>site</string> <string>site</string>
<string>not_closed_state_list</string>
<string>None</string>
<string>_getitem_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>root_site_url</string>
<string>root_site_uid</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>portal_type_list</string>
<string>document_list</string> <string>document_list</string>
<string>_getiter_</string>
<string>document</string> <string>document</string>
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
<string>Message</string> <string>Message</string>
...@@ -172,6 +145,7 @@ for document in document_list:\n ...@@ -172,6 +145,7 @@ for document in document_list:\n
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>portal_type</string> <string>portal_type</string>
<string>reference</string> <string>reference</string>
<string>None</string>
<string>message</string> <string>message</string>
</tuple> </tuple>
</value> </value>
......
...@@ -68,16 +68,33 @@ ...@@ -68,16 +68,33 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>site_uid = context.getSiteUid()\n <value> <string>if site is not None:\n
site_uid = site.getUid()\n
else:\n
site_uid = context.getSiteUid()\n
operation_list = []\n operation_list = []\n
if site_uid is not None:\n if site_uid is not None:\n
not_closed_state_list = (\'ordered\',\'planned\',\'confirmed\',\'started\',\'stopped\')\n not_closed_state_list = (\'ordered\',\'planned\',\'confirmed\',\'started\',\'stopped\')\n
portal_type_list = [x for x in context.getPortalDeliveryTypeList() if x != \'Cash Movement\']\n portal_type_list = [x for x in context.getPortalDeliveryTypeList()]\n
operation_list.extend(context.Baobab_getRemainingOperationList(\n document_list = context.Baobab_getRemainingOperationList(\n
site_uid=site_uid,\n site_uid=site_uid,\n
simulation_state=not_closed_state_list,\n simulation_state=not_closed_state_list,\n
portal_type=portal_type_list))\n portal_type=portal_type_list)\n
append = operation_list.append\n
for document in document_list:\n
# Cash movement in ordered stated are allowed\n
if document.getPortalType()==\'Cash Movement\':\n
if document.getSimulationState()==\'ordered\':\n
continue\n
append(document)\n
\n \n
def operation_sort(a,b):\n
result = cmp(a.getPortalType(),b.getPortalType())\n
if result==0:\n
result = cmp(a.getSourceReference(),b.getSourceReference())\n
return result\n
\n
operation_list.sort(operation_sort)\n
\n \n
return operation_list\n return operation_list\n
</string> </value> </string> </value>
...@@ -102,7 +119,7 @@ return operation_list\n ...@@ -102,7 +119,7 @@ return operation_list\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>site=None,**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -122,24 +139,28 @@ return operation_list\n ...@@ -122,24 +139,28 @@ return operation_list\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>site</string>
<string>kw</string> <string>kw</string>
<string>None</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string>
<string>site_uid</string> <string>site_uid</string>
<string>context</string>
<string>operation_list</string> <string>operation_list</string>
<string>None</string>
<string>not_closed_state_list</string> <string>not_closed_state_list</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>x</string> <string>x</string>
<string>portal_type_list</string> <string>portal_type_list</string>
<string>document_list</string>
<string>document</string>
<string>operation_sort</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -151,7 +172,9 @@ return operation_list\n ...@@ -151,7 +172,9 @@ return operation_list\n
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple>
<none/> <none/>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -335,6 +335,10 @@ ...@@ -335,6 +335,10 @@
<string>start_date</string> <string>start_date</string>
<string>Start Date</string> <string>Start Date</string>
</tuple> </tuple>
<tuple>
<string>translated_simulation_state_title</string>
<string>State</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
......
106 109
\ 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