Commit 614e2a31 authored by Sebastien Robin's avatar Sebastien Robin

Aurélien fixed domains

Small changes in computing exchange values
new changes in ImportCsvToCategories

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10947 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bafe6ef9
......@@ -484,6 +484,9 @@
<name>Edit Factories</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Edit ParsedXML</name>
</permission>
<permission type='tuple'>
<name>Edit ReStructuredText</name>
<role>Manager</role>
......@@ -686,6 +689,9 @@
<role>Author</role>
<role>Manager</role>
</permission>
<permission type='list'>
<name>View DOM hierarchy</name>
</permission>
<permission type='tuple'>
<name>View History</name>
<role>Assignee</role>
......
......@@ -486,6 +486,9 @@
<name>Edit Factories</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Edit ParsedXML</name>
</permission>
<permission type='tuple'>
<name>Edit ReStructuredText</name>
<role>Manager</role>
......@@ -689,6 +692,9 @@
<role>Manager</role>
<role>Member</role>
</permission>
<permission type='list'>
<name>View DOM hierarchy</name>
</permission>
<permission type='tuple'>
<name>View History</name>
<role>Assignee</role>
......
......@@ -475,6 +475,9 @@
<name>Edit Factories</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Edit ParsedXML</name>
</permission>
<permission type='tuple'>
<name>Edit ReStructuredText</name>
<role>Manager</role>
......@@ -674,6 +677,9 @@
<role>Author</role>
<role>Manager</role>
</permission>
<permission type='list'>
<name>View DOM hierarchy</name>
</permission>
<permission type='tuple'>
<name>View History</name>
<role>Assignee</role>
......
......@@ -484,6 +484,9 @@
<name>Edit Factories</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Edit ParsedXML</name>
</permission>
<permission type='tuple'>
<name>Edit ReStructuredText</name>
<role>Manager</role>
......@@ -686,6 +689,9 @@
<role>Manager</role>
<role>Member</role>
</permission>
<permission type='list'>
<name>View DOM hierarchy</name>
</permission>
<permission type='tuple'>
<name>View History</name>
<role>Assignee</role>
......
......@@ -484,6 +484,9 @@
<name>Edit Factories</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Edit ParsedXML</name>
</permission>
<permission type='tuple'>
<name>Edit ReStructuredText</name>
<role>Manager</role>
......@@ -686,6 +689,9 @@
<role>Manager</role>
<role>Member</role>
</permission>
<permission type='list'>
<name>View DOM hierarchy</name>
</permission>
<permission type='tuple'>
<name>View History</name>
<role>Assignee</role>
......
......@@ -484,6 +484,9 @@
<name>Edit Factories</name>
<role>Manager</role>
</permission>
<permission type='list'>
<name>Edit ParsedXML</name>
</permission>
<permission type='tuple'>
<name>Edit ReStructuredText</name>
<role>Manager</role>
......@@ -686,6 +689,9 @@
<role>Manager</role>
<role>Member</role>
</permission>
<permission type='list'>
<name>View DOM hierarchy</name>
</permission>
<permission type='tuple'>
<name>View History</name>
<role>Assignee</role>
......
......@@ -381,9 +381,7 @@
</item>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
......@@ -70,10 +70,9 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from Products.ERP5Type.Document import newTempDomain\n
domain_list = []\n
i = 0\n
vault_list = context.Delivery_getVaultItemList(leaf_node=0)\n
vault_list = context.Delivery_getVaultItemList(leaf_node=0, vault_type="site")\n
\n
# get depth\n
depth = len(parent.getPath().split(\'/\')[3:])\n
......@@ -81,7 +80,10 @@ depth = len(parent.getPath().split(\'/\')[3:])\n
for vault in vault_list:\n
if vault[0] != \'\':\n
if len(vault[0].split(\'/\')) == depth: \n
if depth > 1 and vault[0].split(\'/\')[-2] != parent.getId():\n
if depth > 1:\n
path_length = len(vault[0].split(\'/\')) - 1\n
parent_path = \'/\'.join(parent.getPath().split(\'/\')[-path_length:])\n
if \'/\'.join(vault[0].split(\'/\')[:-1]) != parent_path:\n
# only add those from parent\n
continue\n
domain = parent.generateTempDomain(id=vault[0].split(\'/\')[-1])\n
......@@ -100,6 +102,12 @@ return domain_list\n
<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>
......@@ -143,8 +151,6 @@ return domain_list\n
<string>depth</string>
<string>parent</string>
<string>kw</string>
<string>Products.ERP5Type.Document</string>
<string>newTempDomain</string>
<string>domain_list</string>
<string>i</string>
<string>_getattr_</string>
......@@ -154,6 +160,8 @@ return domain_list\n
<string>_getitem_</string>
<string>_getiter_</string>
<string>vault</string>
<string>path_length</string>
<string>parent_path</string>
<string>domain</string>
<string>script</string>
</tuple>
......@@ -183,4 +191,25 @@ return domain_list\n
</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>
......@@ -70,19 +70,20 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from Products.ERP5Type.Document import newTempDomain\n
domain_list = []\n
i = 0\n
vault_list = context.Delivery_getVaultItemList(leaf_node=0)\n
vault_list = context.Delivery_getVaultItemList(leaf_node=0, vault_type=\'site\')\n
\n
# get depth\n
depth = len(parent.getPath().split(\'/\')[3:])\n
\n
for vault in vault_list:\n
if vault[0] != \'\':\n
context.log("vault[0]", vault[0])\n
if len(vault[0].split(\'/\')) == depth: \n
if depth > 1 and vault[0].split(\'/\')[-2] != parent.getId():\n
if len(vault[0].split(\'/\')) == depth:\n
if depth > 1:\n
path_length = len(vault[0].split(\'/\')) - 1\n
parent_path = \'/\'.join(parent.getPath().split(\'/\')[-path_length:])\n
if \'/\'.join(vault[0].split(\'/\')[:-1]) != parent_path:\n
# only add those from parent\n
continue\n
domain = parent.generateTempDomain(id=vault[0].split(\'/\')[-1])\n
......@@ -101,6 +102,12 @@ return domain_list\n
<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>
......@@ -144,8 +151,6 @@ return domain_list\n
<string>depth</string>
<string>parent</string>
<string>kw</string>
<string>Products.ERP5Type.Document</string>
<string>newTempDomain</string>
<string>domain_list</string>
<string>i</string>
<string>_getattr_</string>
......@@ -155,6 +160,8 @@ return domain_list\n
<string>_getitem_</string>
<string>_getiter_</string>
<string>vault</string>
<string>path_length</string>
<string>parent_path</string>
<string>domain</string>
<string>script</string>
</tuple>
......@@ -184,4 +191,25 @@ return domain_list\n
</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>
......@@ -75,7 +75,7 @@ if context.getDestination() is None:\n
\n
dest_site_title = context.getDestinationValue().getSiteTitle()\n
\n
site_list = context.Delivery_getVaultItemList(user_site=0, vault_type=("site", "site/surface/banque_interne/guichet", "site/surface/gros_paiement/guichet", "site/surface/gros_versement/guichet"), strict_membership=1, leaf_node=0, base_site=context.getDestinationValue().getSite())\n
site_list = context.Delivery_getVaultItemList(user_site=0, vault_type=("site", "site/surface/banque_interne/guichet", "site/surface/gros_paiement/guichet", "site/surface/gros_versement/guichet", "site/surface/operations_diverses/guichet"), strict_membership=1, leaf_node=0, base_site=context.getDestinationValue().getSite())\n
# now must filter again this list to remove useless categories\n
site_dict = {}\n
for site in site_list:\n
......
......@@ -437,6 +437,10 @@
<list/>
</value>
</item>
<item>
<key> <string>page_template</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>portal_types</string> </key>
<value>
......@@ -500,7 +504,16 @@
<item>
<key> <string>url_columns</string> </key>
<value>
<list/>
<list>
<tuple>
<string>name</string>
<string></string>
</tuple>
<tuple>
<string>path</string>
<string></string>
</tuple>
</list>
</value>
</item>
</dictionary>
......
......@@ -296,7 +296,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.Delivery_getVaultItemList(vault_type=\'site\', all=1)</string> </value>
<value> <string>python: here.Delivery_getVaultItemList(vault_type=\'site\', all=1,leaf_node=0)</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -73,20 +73,22 @@
commission_ratio = context.getDiscountRatio()\n
commission_price = context.getDiscount()\n
if commission_ratio is not None and commission_ratio !=0 and commission_price is not None and commission_price !=0:\n
return None\n
price = None\n
if commission_ratio == 0 or commission_price == 0:\n
price = round(price,0)\n
return price\n
if commission_ratio is None and commission_price is None:\n
price = round(price,0)\n
return price\n
\n
comission_value = 0\n
if commission_ratio is not None:\n
commission_value = commission_ratio * price\n
\n
if commission_price is not None:\n
commission_value = commission_price\n
\n
if price is None:\n
return price\n
\n
quantity = price - commission_value\n
quantity = round(quantity,0)\n
if quantity!=context.getQuantity():\n
......@@ -153,6 +155,7 @@ return quantity\n
<string>commission_price</string>
<string>None</string>
<string>round</string>
<string>comission_value</string>
<string>commission_value</string>
<string>quantity</string>
</tuple>
......
......@@ -73,20 +73,22 @@
commission_ratio = context.getDiscountRatio()\n
commission_price = context.getDiscount()\n
if commission_ratio is not None and commission_ratio !=0 and commission_price is not None and commission_price !=0:\n
return None\n
if commission_ratio == 0 or commission_price == 0:\n
price = None\n
elif commission_ratio == 0 or commission_price == 0:\n
price = round(price,0)\n
return price\n
if commission_ratio is None and commission_price is None:\n
elif commission_ratio is None and commission_price is None:\n
price = round(price,0)\n
return price\n
\n
commission_value = 0\n
if commission_ratio is not None:\n
commission_value = commission_ratio * price\n
\n
if commission_price is not None:\n
commission_value = commission_price\n
\n
if price is None:\n
return price\n
\n
quantity = price + commission_value\n
quantity = round(quantity,0)\n
if quantity!=context.getQuantity():\n
......
......@@ -68,15 +68,14 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
# return context.getMovementList(portal_type=portal_type)\n
<value> <string># return context.getMovementList(portal_type=portal_type)\n
# here we suppose we have only two level of portal type\n
#context.log("Delivery_getMovementList", "portal_type = %s" %(portal_type,))\n
#context.log("Delivery_getMovementList", "len portal_type = %s" % (len(portal_type),))\n
\n
if not same_type(portal_type, []):\n
return context.getMovementList(portal_type=portal_type)\n
if len(portal_type) > 2 or len(portal_type) == 0:\n
if len(portal_type) != 2:\n
# use catalog\n
return context.getMovementList(portal_type=portal_type)\n
\n
......@@ -99,9 +98,7 @@ for line in line_list:\n
cell_list.extend(list(line.objectValues(portal_type=cell_type)))\n
\n
return cell_list\n
]]></string> </value>
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
......
......@@ -180,6 +180,7 @@ elif import_type == \'assign_codification\' :\n
if len(e_list) == 2 :\n
try :\n
print \'trying to assign to %s ...\' % lowerCase(e_list[0]) ,\n
context.log(\'lowerCase(e_list[0])\',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
......@@ -258,7 +259,9 @@ elif import_type == \'create_subvaults\' :\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
elif subvault == \'Encaisse des Externes\' :\n
subvault_dict[vault].append([\'%s/%s\' % (counter_subvault, "transit"), \'TRA\'])\n
elif 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
......@@ -268,7 +271,7 @@ elif import_type == \'create_subvaults\' :\n
else:\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 in (\'Encaisse des Billets Recus pour Ventilation Venant de\',\'Encaisse des Billets en Transit Allant a\',\n
elif subvault in (\'Encaisse des Billets Recus pour Ventilation Venant de\',\'Encaisse des Billets en Transit Allant a\',\n
\'Encaisse des Billets Neufs Non Emis en Transit Allant a\') :\n
for c in context.portal_categories.site.agence.principale.objectIds() :\n
if counter_name in two_way_counter_list:\n
......@@ -292,6 +295,8 @@ elif import_type == \'create_subvaults\' :\n
# parse the for site category tree and add sub categories if required\n
#for c in context.portal_categories.site.getCategoryChildValueList() :\n
#for c in context.portal_categories.site.agence.principale.lome.getCategoryChildValueList() :\n
#for c in context.portal_categories.site.getCategoryChildValueList() :\n
#for c in context.portal_categories.site.agence.principale.cotonou.getCategoryChildValueList() :\n
for c in context.portal_categories.site.getCategoryChildValueList() :\n
context.log(\'c.getPath()\',c.getPath())\n
for vault_type in vault_type_list :\n
......@@ -325,6 +330,16 @@ elif import_type == \'create_subvaults\' :\n
subcat_vault_type = \'%s/guichet\' %(\'/\'.join(vault_type.split(\'/\')[1:]),)\n
elif \'retire\' in subvault_path.lower():\n
subcat_vault_type = \'%s/retire\' %(\'/\'.join(vault_type.split(\'/\')[1:]),)\n
elif subvault_path.lower().endswith(\'externes\'):\n
subcat_vault_type = \'%s/encaisse_des_externes\' %(\'/\'.join(vault_type.split(\'/\')[1:]),)\n
elif subvault_path.lower().endswith(\'transit\'):\n
subcat_vault_type = \'%s/encaisse_des_externes/transit\' %(\'/\'.join(vault_type.split(\'/\')[1:]),)\n
elif \'devises\' in subvault_path.lower():\n
subcat_vault_type = \'%s/encaisse_des_devises\' %(\'/\'.join(vault_type.split(\'/\')[1:]),)\n
elif \'mutiles\' in subvault_path.lower():\n
subcat_vault_type = \'%s/billets_mutiles\' %(\'/\'.join(vault_type.split(\'/\')[1:]),)\n
elif \'macules\' in subvault_path.lower():\n
subcat_vault_type = \'%s/billets_macules\' %(\'/\'.join(vault_type.split(\'/\')[1:]),)\n
else:\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
......
......@@ -40,7 +40,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Stopped (Check)</string> </value>
<value> <string>Cancelled (Check)</string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
......
29
\ No newline at end of file
42
\ 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