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 @@
<name>Add Cookie Crumblers</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Add Database Methods</name>
<role>Manager</role>
......@@ -351,6 +357,9 @@
<name>Change Browser Id Manager</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Change DTML Documents</name>
<role>Manager</role>
......@@ -494,6 +503,9 @@
<permission type='list'>
<name>Edit target</name>
</permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>FTP access</name>
<role>Manager</role>
......
......@@ -119,6 +119,12 @@
<name>Add Cookie Crumblers</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Add Database Methods</name>
<role>Manager</role>
......@@ -353,6 +359,9 @@
<name>Change Browser Id Manager</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Change DTML Documents</name>
<role>Manager</role>
......@@ -496,6 +505,9 @@
<permission type='list'>
<name>Edit target</name>
</permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>FTP access</name>
<role>Manager</role>
......
......@@ -110,6 +110,12 @@
<name>Add Cookie Crumblers</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Add Database Methods</name>
<role>Manager</role>
......@@ -343,6 +349,9 @@
<name>Change Browser Id Manager</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Change DTML Documents</name>
<role>Manager</role>
......@@ -485,6 +494,9 @@
<permission type='list'>
<name>Edit target</name>
</permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>FTP access</name>
<role>Manager</role>
......
......@@ -117,6 +117,12 @@
<name>Add Cookie Crumblers</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Add Database Methods</name>
<role>Manager</role>
......@@ -351,6 +357,9 @@
<name>Change Browser Id Manager</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Change DTML Documents</name>
<role>Manager</role>
......@@ -494,6 +503,9 @@
<permission type='list'>
<name>Edit target</name>
</permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>FTP access</name>
<role>Manager</role>
......
......@@ -117,6 +117,12 @@
<name>Add Cookie Crumblers</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Add Database Methods</name>
<role>Manager</role>
......@@ -351,6 +357,9 @@
<name>Change Browser Id Manager</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Change DTML Documents</name>
<role>Manager</role>
......@@ -494,6 +503,9 @@
<permission type='list'>
<name>Edit target</name>
</permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>FTP access</name>
<role>Manager</role>
......
......@@ -117,6 +117,12 @@
<name>Add Cookie Crumblers</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Add DCOracle2 Database Connections</name>
</permission>
<permission type='list'>
<name>Add DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Add Database Methods</name>
<role>Manager</role>
......@@ -351,6 +357,9 @@
<name>Change Browser Id Manager</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Change DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>Change DTML Documents</name>
<role>Manager</role>
......@@ -494,6 +503,9 @@
<permission type='list'>
<name>Edit target</name>
</permission>
<permission type='list'>
<name>Execute DCOracle2 Stored Procedures</name>
</permission>
<permission type='tuple'>
<name>FTP access</name>
<role>Manager</role>
......
......@@ -71,32 +71,14 @@
<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
\n
not_closed_state_list = (\'ordered\',\'planned\',\'confirmed\',\'started\',\'stopped\')\n
if site is None:\n
root_site_url = context.Baobab_getUserAssignedRootSiteList()[0]\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
document_list = context.CounterDate_getRemainingOperationList(site=site)\n
\n
\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.DCWorkflow.DCWorkflow import ValidationFailed\n
portal_type = document.getTranslatedPortalType()\n
reference = document.getReference()\n
reference = document.getSourceReference()\n
if reference is None:\n
reference = Message(domain=\'ui\',message=\'Not defined\')\n
message = Message(domain="ui", \n
......@@ -152,19 +134,10 @@ for document in document_list:\n
<value>
<tuple>
<string>site</string>
<string>not_closed_state_list</string>
<string>None</string>
<string>_getitem_</string>
<string>_getattr_</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>_getiter_</string>
<string>document</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
......@@ -172,6 +145,7 @@ for document in document_list:\n
<string>ValidationFailed</string>
<string>portal_type</string>
<string>reference</string>
<string>None</string>
<string>message</string>
</tuple>
</value>
......
......@@ -68,16 +68,33 @@
</item>
<item>
<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
if site_uid is not None:\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
operation_list.extend(context.Baobab_getRemainingOperationList(\n
portal_type_list = [x for x in context.getPortalDeliveryTypeList()]\n
document_list = context.Baobab_getRemainingOperationList(\n
site_uid=site_uid,\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
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
return operation_list\n
</string> </value>
......@@ -102,7 +119,7 @@ return operation_list\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>site=None,**kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -122,24 +139,28 @@ return operation_list\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>site</string>
<string>kw</string>
<string>None</string>
<string>_getattr_</string>
<string>context</string>
<string>site_uid</string>
<string>context</string>
<string>operation_list</string>
<string>None</string>
<string>not_closed_state_list</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>portal_type_list</string>
<string>document_list</string>
<string>document</string>
<string>operation_sort</string>
</tuple>
</value>
</item>
......@@ -151,7 +172,9 @@ return operation_list\n
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
......
......@@ -335,6 +335,10 @@
<string>start_date</string>
<string>Start Date</string>
</tuple>
<tuple>
<string>translated_simulation_state_title</string>
<string>State</string>
</tuple>
</list>
</value>
</item>
......
106
\ No newline at end of file
109
\ 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