Commit b7e2e2d8 authored by Sebastien Robin's avatar Sebastien Robin

Fixed some problems on the currency exchange prices

Fixed the display of the current site in Delivery_getVaultItemList
Improved the script used for reports

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9342 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 21c35185
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>3.0</float> </value> <value> <float>4.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -90,9 +90,9 @@ if site is None:\n ...@@ -90,9 +90,9 @@ if site is None:\n
site = context.Baobab_getVaultSite(site)\n site = context.Baobab_getVaultSite(site)\n
\n \n
kw = {"portal_type" : \'Counter Date\', "delivery.start_date" : str(date), "site_id" : site.getId(), "simulation_state" : "open"}\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 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 context.log(\'Baobab_checkCounterDateOpen\', \'counter_date_list = %s, requete = %s\' %(counter_date_list, context.portal_catalog(src__=1, **kw)))\n
\n \n
if len(counter_date_list) == 0:\n if len(counter_date_list) == 0:\n
return 0\n return 0\n
......
...@@ -72,9 +72,11 @@ ...@@ -72,9 +72,11 @@
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
site = vault\n site = vault\n
if same_type(site, \'\'):\n if same_type(site, \'\'):\n
if site.startswith(\'site/\'):\n
site = site[len(\'site/\'):]\n
site = context.restrictedTraverse(\'portal_categories/site/%s\' %(site,))\n site = context.restrictedTraverse(\'portal_categories/site/%s\' %(site,))\n
\n \n
#context.log(\'site\', site)\n context.log(\'site\', site)\n
while True:\n while True:\n
if not hasattr(site, \'getVaultTypeList\'):\n if not hasattr(site, \'getVaultTypeList\'):\n
msg = Message(domain = \'ui\', message = \'The site value is misconfigured; report this to system administrators.\')\n msg = Message(domain = \'ui\', message = \'The site value is misconfigured; report this to system administrators.\')\n
...@@ -137,6 +139,8 @@ return site\n ...@@ -137,6 +139,8 @@ return site\n
<string>site</string> <string>site</string>
<string>same_type</string> <string>same_type</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>_getitem_</string>
<string>len</string>
<string>context</string> <string>context</string>
<string>True</string> <string>True</string>
<string>hasattr</string> <string>hasattr</string>
......
...@@ -86,6 +86,10 @@ ...@@ -86,6 +86,10 @@
\n \n
# Last, compare the variations (such as the years 1994 and 2003).\n # Last, compare the variations (such as the years 1994 and 2003).\n
result = cmp(a.variation_text_title, b.variation_text_title)\n result = cmp(a.variation_text_title, b.variation_text_title)\n
if result != 0:\n
return result\n
\n
result = cmp(a.date,b.date)\n
return result\n return result\n
\n \n
currency_cash_list.sort(sortLines)\n currency_cash_list.sort(sortLines)\n
...@@ -94,8 +98,6 @@ ...@@ -94,8 +98,6 @@
returned_value = context.CounterModule_getVaultTransactionList(**kw)\n returned_value = context.CounterModule_getVaultTransactionList(**kw)\n
returned_value = sortCurrencyCashList(returned_value)\n returned_value = sortCurrencyCashList(returned_value)\n
\n \n
context.log("CounterModule_getVaultInventoryList", "returned_value = %s" %(returned_value[0],))\n
\n
\n \n
return returned_value\n return returned_value\n
</string> </value> </string> </value>
...@@ -156,7 +158,6 @@ return returned_value\n ...@@ -156,7 +158,6 @@ return returned_value\n
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>returned_value</string> <string>returned_value</string>
<string>_getitem_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -91,12 +91,16 @@ resource_dict = {}\n ...@@ -91,12 +91,16 @@ resource_dict = {}\n
vault_dict = {}\n vault_dict = {}\n
vault_inventory_dict = {}\n vault_inventory_dict = {}\n
\n \n
\n
vault_url = vault\n vault_url = vault\n
vault_dict[vault_url] = 1\n vault_dict[vault_url] = 1\n
\n
vault_inventory_dict[vault_url] = {}\n vault_inventory_dict[vault_url] = {}\n
inventory_kw = {}\n inventory_kw = {}\n
inventory_kw[\'group_by_variation\'] = 1\n context.log(\'CounterModule_getVaultTransactionList, vault_report_type\',vault_report_type)\n
inventory_kw[\'group_by_resource\'] = 1\n if vault_report_type is None or vault_report_type==\'inventory\':\n
inventory_kw[\'group_by_variation\'] = 1\n
inventory_kw[\'group_by_resource\'] = 1\n
# add to get by portal type inventory\n # add to get by portal type inventory\n
if kw.has_key("portal_type"):\n if kw.has_key("portal_type"):\n
inventory_kw[\'portal_type\'] = kw[\'portal_type\']\n inventory_kw[\'portal_type\'] = kw[\'portal_type\']\n
...@@ -114,6 +118,18 @@ if at_date is not None:\n ...@@ -114,6 +118,18 @@ if at_date is not None:\n
if from_date is not None:\n if from_date is not None:\n
inventory_kw[\'from_date\'] = from_date\n inventory_kw[\'from_date\'] = from_date\n
\n \n
if column_names == 1:\n
column_list = [(\'resource\', \'Resource\'), (\'variation_text\', \'Year\')]\n
column_list.extend([(\'explanation_relative_url\',\'Explanation\')])\n
for vault in vault_dict.keys():\n
#context.log(\'getTitleFromCategoryUrl(vault)\',getTitleFromCategoryUrl(vault))\n
column_list.extend([\n
(vault + \'_quantity\', getTitleFromCategoryUrl(vault) + \' Quantity\'),\n
(vault + \'_total_price\', getTitleFromCategoryUrl(vault) + \' TotalPrice\')\n
])\n
column_list.append((\'general_total_price\', \'General TotalPrice\'))\n
return column_list\n
\n
vault_inventory_list = context.portal_simulation.getCurrentInventoryList( node_category=vault\n vault_inventory_list = context.portal_simulation.getCurrentInventoryList( node_category=vault\n
, ignore_variation=0\n , ignore_variation=0\n
,**inventory_kw\n ,**inventory_kw\n
...@@ -128,6 +144,8 @@ for vault_inventory in vault_inventory_list:\n ...@@ -128,6 +144,8 @@ for vault_inventory in vault_inventory_list:\n
#context.log(\'vault_inventory total_quantity\',vault_inventory.total_quantity)\n #context.log(\'vault_inventory total_quantity\',vault_inventory.total_quantity)\n
#context.log(\'vault_inventory total_price\',vault_inventory.total_price)\n #context.log(\'vault_inventory total_price\',vault_inventory.total_price)\n
resource = (vault_inventory.resource_uid, vault_inventory.variation_text or \'\')\n resource = (vault_inventory.resource_uid, vault_inventory.variation_text or \'\')\n
if vault_report_type==\'history\':\n
resource = (vault_inventory.resource_uid, vault_inventory.variation_text or \'\',vault_inventory.stock_uid)\n
if not vault_inventory_dict[vault_url].has_key(resource):\n if not vault_inventory_dict[vault_url].has_key(resource):\n
total_quantity = vault_inventory.total_quantity\n total_quantity = vault_inventory.total_quantity\n
if total_quantity is None:\n if total_quantity is None:\n
...@@ -135,22 +153,12 @@ for vault_inventory in vault_inventory_list:\n ...@@ -135,22 +153,12 @@ for vault_inventory in vault_inventory_list:\n
total_price = vault_inventory.total_price\n total_price = vault_inventory.total_price\n
if total_price is None:\n if total_price is None:\n
total_price = 0\n total_price = 0\n
vault_inventory_dict[vault_url][resource] = {\'quantity\':total_quantity, \'total_price\':total_price}\n vault_inventory_dict[vault_url][resource] = {\'quantity\':total_quantity, \'total_price\':total_price,\n
\'date\':vault_inventory.date}\n
\n \n
resource_dict[resource] = 1\n resource_dict[resource] = 1\n
\n \n
\n \n
if column_names == 1:\n
column_list = [(\'resource\', \'Resource\'), (\'variation_text\', \'Year\')]\n
for vault in vault_dict.keys():\n
#context.log(\'getTitleFromCategoryUrl(vault)\',getTitleFromCategoryUrl(vault))\n
column_list.extend([\n
(vault + \'_quantity\', getTitleFromCategoryUrl(vault) + \' Quantity\'),\n
(vault + \'_total_price\', getTitleFromCategoryUrl(vault) + \' TotalPrice\')\n
])\n
column_list.append((\'general_total_price\', \'General TotalPrice\'))\n
return column_list\n
\n
total_inventory_list = []\n total_inventory_list = []\n
\n \n
#context.log(\'resource_dict\',resource_dict)\n #context.log(\'resource_dict\',resource_dict)\n
...@@ -175,9 +183,22 @@ for resource in resource_dict.keys():\n ...@@ -175,9 +183,22 @@ for resource in resource_dict.keys():\n
tmp_dict[\'variation_text_title\'] = \' \'.join(getVariationTitleList(resource[1]))\n tmp_dict[\'variation_text_title\'] = \' \'.join(getVariationTitleList(resource[1]))\n
#resource = (vault_inventory.resource_uid, tuple(getVariationTitleList(vault_inventory.variation_text or \'\')))\n #resource = (vault_inventory.resource_uid, tuple(getVariationTitleList(vault_inventory.variation_text or \'\')))\n
resource_value = context.portal_catalog.getObject(resource[0])\n resource_value = context.portal_catalog.getObject(resource[0])\n
if resource_value.getPortalType() not in resource_portal_type:\n
continue\n
if len(resource)==3:\n
movement = context.portal_catalog.getObject(resource[2])\n
context.log(\'movement\',movement)\n
explanation_value = movement\n
if getattr(movement,\'getExplanationValue\',None) is not None:\n
explanation_value = movement.getExplanationValue()\n
tmp_dict[\'explanation_relative_url\'] = explanation_value.getRelativeUrl()\n
tmp_dict[\'base_price\'] = resource_value.getBasePrice()\n tmp_dict[\'base_price\'] = resource_value.getBasePrice()\n
tmp_dict[\'resource_title\'] = resource_value.getTitle()\n tmp_dict[\'resource_title\'] = resource_value.getTitle()\n
context.log(\'resource_value\',resource_value.getRelativeUrl())\n
try:\n
tmp_dict[\'resource_translated_title\'] = resource_value.getTranslatedTitle()\n tmp_dict[\'resource_translated_title\'] = resource_value.getTranslatedTitle()\n
except KeyError:\n
tmp_dict[\'resource_translated_title\'] = resource_value.getTitle()\n
tmp_dict[\'price_currency_title\'] = resource_value.getPriceCurrencyTitle()\n tmp_dict[\'price_currency_title\'] = resource_value.getPriceCurrencyTitle()\n
tmp_dict[\'price_currency\'] = resource_value.getPriceCurrency()\n tmp_dict[\'price_currency\'] = resource_value.getPriceCurrency()\n
tmp_dict[\'resource_portal_type\'] = resource_value.getPortalType()\n tmp_dict[\'resource_portal_type\'] = resource_value.getPortalType()\n
...@@ -188,7 +209,8 @@ for resource in resource_dict.keys():\n ...@@ -188,7 +209,8 @@ for resource in resource_dict.keys():\n
except KeyError:\n except KeyError:\n
resource_in_vault = {\'quantity\' : 0,\'total_price\' : 0}\n resource_in_vault = {\'quantity\' : 0,\'total_price\' : 0}\n
tmp_dict.update({\'total_quantity\' : resource_in_vault[\'quantity\'],\n tmp_dict.update({\'total_quantity\' : resource_in_vault[\'quantity\'],\n
\'total_price\' : resource_in_vault[\'total_price\']})\n \'total_price\' : resource_in_vault[\'total_price\'],\n
\'date\':resource_in_vault[\'date\']})\n
general_total_price += resource_in_vault[\'total_price\']\n general_total_price += resource_in_vault[\'total_price\']\n
tmp_dict[\'general_total_price\'] = general_total_price\n tmp_dict[\'general_total_price\'] = general_total_price\n
total_inventory_list.append(newTempBase(context, "new_%3i" % i, **tmp_dict))\n total_inventory_list.append(newTempBase(context, "new_%3i" % i, **tmp_dict))\n
...@@ -229,7 +251,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -229,7 +251,7 @@ return repr([x for x in total_inventory_list])\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>vault=None,at_date=None,from_date=None,vault_report_type=None,column_names=0, **kw</string> </value> <value> <string>vault=None,at_date=None,from_date=None,vault_report_type=None,column_names=0,resource_portal_type=(\'Banknote\',\'Coin\'),**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -249,7 +271,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -249,7 +271,7 @@ return repr([x for x in total_inventory_list])\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>5</int> </value> <value> <int>6</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -260,6 +282,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -260,6 +282,7 @@ return repr([x for x in total_inventory_list])\n
<string>from_date</string> <string>from_date</string>
<string>vault_report_type</string> <string>vault_report_type</string>
<string>column_names</string> <string>column_names</string>
<string>resource_portal_type</string>
<string>kw</string> <string>kw</string>
<string>Products.ERP5Type.Document</string> <string>Products.ERP5Type.Document</string>
<string>newTempBase</string> <string>newTempBase</string>
...@@ -273,26 +296,30 @@ return repr([x for x in total_inventory_list])\n ...@@ -273,26 +296,30 @@ return repr([x for x in total_inventory_list])\n
<string>_write_</string> <string>_write_</string>
<string>inventory_kw</string> <string>inventory_kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>_getitem_</string> <string>context</string>
<string>None</string> <string>None</string>
<string>_getitem_</string>
<string>column_list</string>
<string>_getiter_</string>
<string>_apply_</string> <string>_apply_</string>
<string>context</string>
<string>vault_inventory_list</string> <string>vault_inventory_list</string>
<string>_getiter_</string>
<string>vault_inventory</string> <string>vault_inventory</string>
<string>resource</string> <string>resource</string>
<string>total_quantity</string> <string>total_quantity</string>
<string>total_price</string> <string>total_price</string>
<string>column_list</string>
<string>total_inventory_list</string> <string>total_inventory_list</string>
<string>i</string> <string>i</string>
<string>variation_text</string> <string>variation_text</string>
<string>tmp_dict</string> <string>tmp_dict</string>
<string>variation</string> <string>variation</string>
<string>resource_value</string> <string>resource_value</string>
<string>len</string>
<string>movement</string>
<string>explanation_value</string>
<string>getattr</string>
<string>KeyError</string>
<string>general_total_price</string> <string>general_total_price</string>
<string>resource_in_vault</string> <string>resource_in_vault</string>
<string>KeyError</string>
<string>sort_base_price</string> <string>sort_base_price</string>
<string>repr</string> <string>repr</string>
<string>append</string> <string>append</string>
...@@ -315,6 +342,10 @@ return repr([x for x in total_inventory_list])\n ...@@ -315,6 +342,10 @@ return repr([x for x in total_inventory_list])\n
<none/> <none/>
<none/> <none/>
<int>0</int> <int>0</int>
<tuple>
<string>Banknote</string>
<string>Coin</string>
</tuple>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -251,10 +251,6 @@ ...@@ -251,10 +251,6 @@
<string>inventory</string> <string>inventory</string>
<string>inventory</string> <string>inventory</string>
</tuple> </tuple>
<tuple>
<string>unvariated_inventory</string>
<string>unvariated_inventory</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -365,6 +365,14 @@ ...@@ -365,6 +365,14 @@
<string>variation_title</string> <string>variation_title</string>
<string>Variation</string> <string>Variation</string>
</tuple> </tuple>
<tuple>
<string>date</string>
<string>Date</string>
</tuple>
<tuple>
<string>explanation_relative_url</string>
<string>Explanation</string>
</tuple>
<tuple> <tuple>
<string>total_quantity</string> <string>total_quantity</string>
<string>Quantity</string> <string>Quantity</string>
......
<?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>
<none/>
</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>parent = context.getParentValue()\n
start_date = parent.getStartDate()\n
stop_date = parent.getStopDate()\n
identity_criterion = {\'start_date\':(start_date,stop_date)}\n
return context.asContext(_range_criterion=identity_criterion)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/baobab/portal_skins/erp5_banking_core/CurrencyExchangeCell_asPredicate</string> </value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>parent</string>
<string>start_date</string>
<string>stop_date</string>
<string>identity_criterion</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CurrencyExchangeCell_asPredicate</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>
<none/>
</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>start_date = context.getStartDate()\n
stop_date = context.getStopDate()\n
identity_criterion = {\'start_date\':(start_date,stop_date)}\n
return context.asContext(_range_criterion=identity_criterion)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/baobab/portal_skins/erp5_banking_core/CurrencyExchangeLine_asPredicate</string> </value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>start_date</string>
<string>stop_date</string>
<string>identity_criterion</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CurrencyExchangeLine_asPredicate</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.Form</string>
<string>ERP5Form</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list>
<string>my_start_date</string>
<string>my_stop_date</string>
</list>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_base_price</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_title</string>
<string>my_price_currency_id</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list>
<string>my_source_title</string>
<string>my_base_price</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CurrencyExchangeLine_view</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>CurrencyExchangeLine_view</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Currency Exchange Line</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>FloatField</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_base_price</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>
<item>
<key> <string>not_float</string> </key>
<value> <string>You did not enter a floating point number.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>precision</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>precision</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>input_style</string> </key>
<value> <string>-1234.5</string> </value>
</item>
<item>
<key> <string>precision</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>listbox_base_price</string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>FloatField</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_base_price</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>
<item>
<key> <string>not_float</string> </key>
<value> <string>You did not enter a floating point number.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>precision</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>precision</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>input_style</string> </key>
<value> <string>-1234.5</string> </value>
</item>
<item>
<key> <string>precision</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Fixing Price</string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -92,6 +92,46 @@ ...@@ -92,6 +92,46 @@
\n \n
from Products.ERP5Type.Cache import CachingMethod\n from Products.ERP5Type.Cache import CachingMethod\n
\n \n
def calculateNewTitle(title_path_list,path_len=0):\n
if \'Encaisse\' in title_path_list[-1]:\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
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
else:\n
if path_len <= 2:\n
new_title_list = title_path_list[:]\n
for i in xrange(path_len):\n
if i%2 == 0 and i != 0:\n
new_title_list.append(title_path_list[i])\n
elif \'Ventilation\' in title_path_list[i]:\n
new_title_list.append(\'Ventilation\')\n
elif \'Transit\' in title_path_list[i]:\n
new_title_list.append(\'Transit\')\n
if id not in new_title_list: # ie last part of path\n
new_title_list.append(id)\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
return new_title_list\n
\n
def getVaultItemList(vault_type=None, exclude_vault_type=None,\n def getVaultItemList(vault_type=None, exclude_vault_type=None,\n
user_site=1, leaf_node=1, strict_membership=0, assignment_list=None, site_list=None, with_base=1, all=0):\n user_site=1, leaf_node=1, strict_membership=0, assignment_list=None, site_list=None, with_base=1, all=0):\n
\n \n
...@@ -168,43 +208,8 @@ def getVaultItemList(vault_type=None, exclude_vault_type=None,\n ...@@ -168,43 +208,8 @@ def getVaultItemList(vault_type=None, exclude_vault_type=None,\n
title_path_list = title_path_list[:-1]\n title_path_list = title_path_list[:-1]\n
id_path_list = id_path_list[:-1]\n id_path_list = id_path_list[:-1]\n
path_len = path_len - 1\n path_len = path_len - 1\n
if \'Encaisse\' in title_path_list[-1]:\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 \n
new_title_list = []\n new_title_list = calculateNewTitle(title_path_list,path_len=path_len)\n
# create new title\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
else:\n
if path_len <= 2:\n
new_title_list = title_path_list[:]\n
for i in xrange(path_len):\n
if i%2 == 0 and i != 0:\n
new_title_list.append(title_path_list[i])\n
elif \'Ventilation\' in title_path_list[i]:\n
new_title_list.append(\'Ventilation\')\n
elif \'Transit\' in title_path_list[i]:\n
new_title_list.append(\'Transit\')\n
if id not in new_title_list: # ie last part of path\n
new_title_list.append(id)\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 \n
new_id = \'/\'.join(new_title_list)\n new_id = \'/\'.join(new_title_list)\n
if with_base:\n if with_base:\n
...@@ -255,7 +260,10 @@ if current_url != None :\n ...@@ -255,7 +260,10 @@ if current_url != None :\n
current_category = context.portal_categories.getCategoryValue(current_url)\n current_category = context.portal_categories.getCategoryValue(current_url)\n
if current_category is not None :\n if current_category is not None :\n
if current_category.getRelativeUrl() not in [x[1] for x in vault_list] :\n if current_category.getRelativeUrl() not in [x[1] for x in vault_list] :\n
return [(\'\', \'\'), (current_category.getRelativeUrl(), current_url)] + list(vault_list)\n # Get the logical path of the current category\n
logical_path_list = current_category.getLogicalPath().split(\'/\')\n
title = \'/\'.join(calculateNewTitle(logical_path_list,path_len=len(logical_path_list)))\n
return [(\'\', \'\'), (title, current_url)] + list(vault_list)\n
else :\n else :\n
return [(\'\', \'\'), (context.Localizer.erp5_ui.gettext(\'Unknown Vault\')+\' : %s\' % current_url, current_url)] + list(vault_list)\n return [(\'\', \'\'), (context.Localizer.erp5_ui.gettext(\'Unknown Vault\')+\' : %s\' % current_url, current_url)] + list(vault_list)\n
return [(\'\', \'\')] + list(vault_list)\n return [(\'\', \'\')] + list(vault_list)\n
...@@ -333,6 +341,7 @@ return [(\'\', \'\')] + list(vault_list)\n ...@@ -333,6 +341,7 @@ return [(\'\', \'\')] + list(vault_list)\n
<string>owner_site</string> <string>owner_site</string>
<string>Products.ERP5Type.Cache</string> <string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string> <string>CachingMethod</string>
<string>calculateNewTitle</string>
<string>None</string> <string>None</string>
<string>getVaultItemList</string> <string>getVaultItemList</string>
<string>_getattr_</string> <string>_getattr_</string>
...@@ -348,6 +357,9 @@ return [(\'\', \'\')] + list(vault_list)\n ...@@ -348,6 +357,9 @@ return [(\'\', \'\')] + list(vault_list)\n
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>x</string> <string>x</string>
<string>logical_path_list</string>
<string>len</string>
<string>title</string>
<string>list</string> <string>list</string>
</tuple> </tuple>
</value> </value>
......
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