Commit 1cfd8016 authored by Aurel's avatar Aurel

update many skins of banking core to follow new definition of counter

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7006 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent df7baf35
......@@ -88,7 +88,7 @@ context.log(\'Baobab_checkCounterDateOpen\', \'get site for vault %s\' %(site))\
site = context.Baobab_getVaultSite(site)\n
\n
kw = {"portal_type" : \'Counter Date\', "delivery.start_date" : str(date), "site_id" : site.getId(), "simulation_state" : "open"}\n
#context.log(\'Baobab_checkCounterDateOpen\', \'kw = %s\' %(kw,))\n
context.log(\'Baobab_checkCounterDateOpen\', \'kw = %s\' %(kw,))\n
counter_date_list = [x.getObject() for x in context.portal_catalog(**kw)]\n
#context.log(\'Baobab_checkCounterDateOpen\', \'counter_date_list = %s, requete = %s\' %(counter_date_list, context.portal_catalog(src__=1, **kw)))\n
\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value> <string encoding="base64">bfINCg==</string> </value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># return counter list for a given site and a given vault type\n
\n
if vault_type is None:\n
vault_type = (\'site/surface/banque_interne\', \'site/surface/gros_paiement\', \'site/surface/gros_versement\', \'site/surface/operations_diverses\')\n
\n
\n
vault_list = context.Delivery_getVaultItemList(vault_type=vault_type, strict_membership = 0, leaf_node=0, user_site=1, with_base=0)\n
counter_dict = {}\n
for vault in vault_list:\n
if len(vault[0].split("/")) == 4:\n
counter = \'/\'.join(vault[0].split("/")[:3])\n
if not counter_dict.has_key(counter):\n
counter_dict[counter] = \'/\'.join(vault[1].split("/")[:6])\n
\n
list = counter_dict.items()\n
list.sort()\n
return list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/baobab/portal_skins/erp5_banking_core/Baobab_getCounterList</string> </value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>vault_type=None, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>vault_type</string>
<string>kw</string>
<string>None</string>
<string>_getattr_</string>
<string>context</string>
<string>vault_list</string>
<string>counter_dict</string>
<string>_getiter_</string>
<string>vault</string>
<string>len</string>
<string>_getitem_</string>
<string>counter</string>
<string>_write_</string>
<string>list</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Baobab_getCounterList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -66,7 +66,27 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>return \'source_payment/organisation_module/2/1\'\n
<value> <string>from Products.ERP5Type.Cache import CachingMethod\n
\n
def getResourceVintageList(banknote=0, coin=0):\n
variation_list = {}\n
if banknote:\n
portal_type_list = ["Banknote",]\n
elif coin:\n
portal_type_list = ["Coin",]\n
else:\n
portal_type_list = ["Banknote", "Coin"]\n
\n
for resource in context.currency_cash_module.objectValues():\n
if resource.getPriceCurrency() == "currency_module/%s" %(context.Baobab_getPortalReferenceCurrencyID(),) and resource.getPortalType() in portal_type_list:\n
for variation in resource.getVariationList():\n
variation_list[variation] = 1\n
return variation_list.keys().sort()\n
\n
\n
getResourceVintageList = CachingMethod(getResourceVintageList, id=\'Baobab_getResourceVintageList\', cache_duration=360000)\n
\n
return getResourceVintageList(banknote, coin)\n
</string> </value>
</item>
<item>
......@@ -75,9 +95,15 @@
<none/>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/baobab/portal_skins/erp5_banking_core/CheckPayment_getBaobabSourcePayment</string> </value>
<value> <string>Script (Python):/baobab/portal_skins/erp5_banking_core/Baobab_getResourceVintageList</string> </value>
</item>
<item>
<key> <string>_owner</string> </key>
......@@ -87,7 +113,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>banknote=0, coin=0</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -107,12 +133,18 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple/>
<tuple>
<string>banknote</string>
<string>coin</string>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>getResourceVintageList</string>
</tuple>
</value>
</item>
</dictionary>
......@@ -123,12 +155,15 @@
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
<tuple>
<int>0</int>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CheckPayment_getBaobabSourcePayment</string> </value>
<value> <string>Baobab_getResourceVintageList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
......@@ -139,4 +174,25 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -68,7 +68,7 @@
<key> <string>_body</string> </key>
<value> <string># get the current logged user site\n
\n
valid_assignment_list = context.Baobab_getUserAssignmentList()\n
valid_assignment_list = context.Baobab_getUserAssignmentList(user_id=user_id)\n
\n
site_list = []\n
for a in valid_assignment_list:\n
......@@ -96,7 +96,7 @@ return site_list\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>user_id=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -124,12 +124,13 @@ return site_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>user_id</string>
<string>_getattr_</string>
<string>context</string>
<string>valid_assignment_list</string>
......@@ -149,7 +150,9 @@ return site_list\n
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
......
......@@ -69,7 +69,10 @@
<value> <string encoding="cdata"><![CDATA[
# get the current logged user site\n
login = context.portal_membership.getAuthenticatedMember().getUserName()\n
if user_id is None:\n
login = context.portal_membership.getAuthenticatedMember().getUserName()\n
else:\n
login = user_id\n
persons = context.acl_users.erp5_users.getUserByLogin(login)\n
\n
if len(persons) == 0:\n
......@@ -122,7 +125,7 @@ return valid_assignment_list\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>user_id=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -150,12 +153,14 @@ return valid_assignment_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>user_id</string>
<string>None</string>
<string>_getattr_</string>
<string>context</string>
<string>login</string>
......@@ -170,7 +175,6 @@ return valid_assignment_list\n
<string>stop</string>
<string>start</string>
<string>DateTime</string>
<string>None</string>
</tuple>
</value>
</item>
......@@ -182,7 +186,9 @@ return valid_assignment_list\n
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
......
......@@ -68,6 +68,8 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
# XXX must use a cache for this method\n
\n
emission_letter_dict = {}\n
user_site_list = []\n
if site == None :\n
......
......@@ -67,6 +67,7 @@
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Message import Message\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
site = vault\n
if same_type(site, \'\'):\n
site = context.restrictedTraverse(\'portal_categories/site/%s\' %(site,))\n
......@@ -129,6 +130,8 @@ return site\n
<string>vault</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>site</string>
<string>same_type</string>
<string>_getattr_</string>
......@@ -136,7 +139,6 @@ return site\n
<string>True</string>
<string>hasattr</string>
<string>msg</string>
<string>ValidationFailed</string>
</tuple>
</value>
</item>
......
......@@ -399,7 +399,12 @@
<item>
<key> <string>editable_columns</string> </key>
<value>
<list/>
<list>
<tuple>
<string>site</string>
<string>site</string>
</tuple>
</list>
</value>
</item>
<item>
......
......@@ -223,7 +223,7 @@
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
......
......@@ -281,7 +281,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'\', \'\')] + [x for x in here.Delivery_getVaultItemList(vault_type=(\'site/surface/banque_interne\', \'site/surface/gros_paiement\', \'site/surface/gros_versement\', \'site/surface/operations_diverses\'), strict_membership = 0, leaf_node=0, user_site=1, current_url=here.getSite(), with_base=0) if len(x[0].split(\'/\')) == 2]</string> </value>
<value> <string>python: here.Baobab_getCounterList()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -163,14 +163,24 @@ def getVaultItemList(vault_type=None, exclude_vault_type=None,\n
id = title_path_list[-1].lstrip("Encaisse des ")\n
else:\n
id = title_path_list[-1]\n
# get a counter if there is\n
counter_name = None\n
for counter in [\'Guichet 1\', \'Guichet 2\', \'Guichet 3\']:\n
if counter in title_path_list:\n
# produce a shorter name for the counter\n
counter_name = \'%s%s\' %(counter[0], counter[-1])\n
# remove counter to construct the list as if there is none\n
title_path_list.remove(counter)\n
path_len = path_len - 1\n
\n
new_title_list = []\n
# create new title\n
if \'Siege\' in title_path_list: \n
if \'Siege\' in title_path_list:\n
new_title_list.append(title_path_list[0]) # ie Siege\n
if path_len > 2:\n
new_title_list.append(title_path_list[2]) # ie Auxiliaire, Devise...\n
if id not in new_title_list: # ie last part of path\n
new_title_list.append(id) \n
new_title_list.append(id)\n
else:\n
if path_len <= 2:\n
new_title_list = title_path_list[:]\n
......@@ -179,7 +189,10 @@ def getVaultItemList(vault_type=None, exclude_vault_type=None,\n
new_title_list.append(title_path_list[i])\n
if id not in new_title_list: # ie last part of path\n
new_title_list.append(id)\n
\n
# put back the counter name into the list\n
if counter_name is not None:\n
new_title_list.insert(2, counter_name)\n
\n
new_id = \'/\'.join(new_title_list)\n
if with_base:\n
item_value = \'/\'.join([\'site\'] + id_path_list[:])\n
......@@ -187,7 +200,7 @@ def getVaultItemList(vault_type=None, exclude_vault_type=None,\n
item_value = \'/\'.join(id_path_list[:])\n
item = (new_id, item_value)\n
vault_dict[new_id] = item_value\n
\n
\n
vault_list = vault_dict.items()\n
vault_list.sort()\n
return vault_list\n
......@@ -198,7 +211,7 @@ if vault_type is None:\n
assignment_list = context.Baobab_getUserAssignmentList()\n
else:\n
assignment_list = None\n
\n
\n
if user_site == 1:\n
site_list = context.Baobab_getUserAssignedSiteList()\n
else:\n
......
......@@ -103,7 +103,7 @@ def create_category(cat, vault_type=None) :\n
context.log(\'create_category\',cat)\n
cat_list = lowerCase(cat).split(\'/\')\n
cat_len = len(cat_list)\n
\n
\n
if cat_len == 1 :\n
# base_category\n
return context.portal_categories.newContent(portal_type = \'Base Category\',\n
......@@ -177,8 +177,19 @@ elif import_type == \'assign_codification\' :\n
print \'trying to assign to %s ...\' % lowerCase(e_list[0]) ,\n
category = context.portal_categories.getCategoryValue(lowerCase(e_list[0]))\n
category.setCodification(e_list[1])\n
# Automatically assign code for some subcategories\n
context.log(\'e_list[0]\',e_list[0])\n
if e_list[0].startswith(\'site\'):\n
vault_code = {\'banque_interne\':\'BI\',\'operations_diverses\':\'OD\',\'gros_paiement\':\'GP\',\'gros_versement\':\'GV\',\n
\'guichet_1\':\'G1\',\'guichet_2\':\'G2\',\'guichet_3\':\'G3\'}\n
context.log(\'category\',category.getPath())\n
for sub_cat in category.getCategoryChildValueList(sort_id=\'path\'):\n
if sub_cat.getId() in vault_code.keys():\n
parent_code = sub_cat.getParentValue().getCodification()\n
code = parent_code + vault_code[sub_cat.getId()]\n
sub_cat.setCodification(code)\n
print \'done %s\' % repr(e_list)\n
except :\n
except KeyError:\n
print \'Failed\'\n
return printed\n
\n
......@@ -200,9 +211,11 @@ elif import_type == \'create_subvaults\' :\n
subvault_dict = {}\n
for e_list in line_list :\n
context.log(\'e_list\', e_list)\n
if len(e_list) == 3 :\n
if len(e_list) in (2,3) :\n
vault = lowerCase(e_list[0]) # ex : Vault_Type/Site/caveau/Auxiliaire\n
subvault = upperCase(e_list[1]) # ex : Encaisse des Devises\n
subvault_code=None\n
if len(e_list)==3:\n
subvault_code = upperCase(e_list[2]) # ex : D\n
counter_string_list = [] # the list of counters, like [\'guichet_1,entrant\',...]\n
one_way_counter_list = (\'gros_paiement\',\'gros_versement\')\n
......@@ -223,39 +236,43 @@ elif import_type == \'create_subvaults\' :\n
else:\n
counter_string_list = [\'\']\n
\n
context.log(\'counter_string_list\',counter_string_list)\n
#context.log(\'counter_string_list\',counter_string_list)\n
if not subvault_dict.has_key(vault) :\n
subvault_dict[vault] = []\n
for counter_string in counter_string_list:\n
context.log(\'counter_string\', counter_string)\n
#context.log(\'counter_string\', counter_string)\n
if counter_string != \'\':\n
counter_subvault = \'%s/%s\' % (counter_string,subvault)\n
else:\n
counter_subvault = subvault\n
context.log(\'counter_subvault\', counter_subvault)\n
#context.log(\'counter_subvault\', counter_subvault)\n
subvault_dict[vault].append([counter_subvault, subvault_code])\n
if subvault == \'Encaisse des Billets et Monnaies\' :\n
if counter_name in two_way_counter_list:\n
subvault_dict[vault].append([\'%s/%s\' % (counter_subvault, "entrante"), None])\n
subvault_dict[vault].append([\'%s/%s\' % (counter_subvault, "sortante"), None])\n
if subvault == \'Encaisse des Devises\' :\n
for c in context.currency_module.objectValues() :\n
if c.getId() != context.Baobab_getPortalReferenceCurrencyID():\n
if counter_name in two_way_counter_list:\n
context.log(\'add encaisse des billets et monnaies E/S\',counter_subvault)\n
#context.log(\'add encaisse des billets et monnaies E/S\',counter_subvault)\n
subvault_dict[vault].append([\'%s/%s/%s\' % (counter_subvault, c.getTitle(), "entrante"), None])\n
subvault_dict[vault].append([\'%s/%s/%s\' % (counter_subvault, c.getTitle(), "sortante"), None])\n
else:\n
context.log(\'add encaisse des billets et monnaies\',counter_subvault)\n
#context.log(\'add encaisse des billets et monnaies\',counter_subvault)\n
subvault_dict[vault].append([\'%s/%s\' % (counter_subvault, c.getTitle()), None])\n
if subvault == \'Encaisse des Billets Recus pour Ventilation\' :\n
for c in context.portal_categories.site.agence.principale.objectIds() :\n
if counter_name in two_way_counter_list:\n
context.log(\'add ventilation E/S\', counter_subvault)\n
#context.log(\'add ventilation E/S\', counter_subvault)\n
subvault_dict[vault].append([\'%s/%s/%s\' % (counter_subvault, upperCase(c), "entrante"), None])\n
subvault_dict[vault].append([\'%s/%s/%s\' % (counter_subvault, upperCase(c), "sortante"), None])\n
else:\n
context.log(\'add ventilation\', counter_subvault)\n
#context.log(\'add ventilation\', counter_subvault)\n
subvault_dict[vault].append([\'%s/%s\' % (counter_subvault, upperCase(c)), None])\n
\n
# subvault_dict looks like this :\n
#subvault_dict : {\'vault_type/site/surface/operations_diverses\': [[\'Encaisse des Devises\', \'D\'], [\'Encaisse des Devises/Francs Suisses\', None], \n
#subvault_dict : {\'vault_type/site/surface/operations_diverses\': [[\'Encaisse des Devises\', \'D\'], [\'Encaisse des Devises/Francs Suisses\', None],\n
# [\'Encaisse des Billets et Monnaies\', \'A\']]}\n
\n
\n
......@@ -285,7 +302,7 @@ elif import_type == \'create_subvaults\' :\n
if \'guichet\' in subvault_path:\n
subcat_vault_type = \'%s/guichet\' %(\'/\'.join(vault_type.split(\'/\')[1:]),)\n
else:\n
subcat_vault_type = \'/\'.join(vault_type.split(\'/\')[1:]) \n
subcat_vault_type = \'/\'.join(vault_type.split(\'/\')[1:])\n
new_category_obj = create_category(cat = \'%s/%s\' % (c.getRelativeUrl(), subvault_path), vault_type = subcat_vault_type)\n
else :\n
print \' creating\', subvault_path\n
......@@ -297,7 +314,7 @@ elif import_type == \'create_subvaults\' :\n
# set codification\n
if subvault_code not in (None, \'\'):\n
new_category_obj.setCodification(subvault_code)\n
\n
\n
print\n
break\n
else : print c.getRelativeUrl(), \'not here\'\n
......@@ -390,7 +407,12 @@ return printed\n
<string>len</string>
<string>e</string>
<string>category</string>
<string>vault_code</string>
<string>sub_cat</string>
<string>parent_code</string>
<string>code</string>
<string>repr</string>
<string>KeyError</string>
<string>vault_type_dict</string>
<string>vault_type_list</string>
<string>subvault_dict</string>
......
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