Commit c3178578 authored by Aurel's avatar Aurel

2006-08-11 aurel

* improve view for counter module inventory report

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9146 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 817844f3
<?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>def sortCurrencyCashList(currency_cash_list):\n
"""Sort a list of currency cash objects\n
"""\n
def sortLines(a, b):\n
"""This method helps sorting supported by Python\'s standard function.\n
"""\n
# First, compare the portal types.\n
result = cmp(a.resource_portal_type, b.resource_portal_type)\n
if result != 0:\n
return result\n
\n
# Second, compare the base prices (such as 1000 and 2000 Francs CFA).\n
result = cmp(a.base_price, b.base_price)\n
if result != 0:\n
return result\n
\n
# Last, compare the variations (such as the years 1994 and 2003).\n
result = cmp(a.variation_text_title, b.variation_text_title)\n
return result\n
\n
currency_cash_list.sort(sortLines)\n
return currency_cash_list\n
\n
returned_value = context.CounterModule_getVaultTransactionList(**kw)\n
returned_value = sortCurrencyCashList(returned_value)\n
\n
context.log("CounterModule_getVaultInventoryList", "returned_value = %s" %(returned_value[0],))\n
\n
\n
return returned_value\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/CounterModule_getVaultInventoryList</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>sortCurrencyCashList</string>
<string>_apply_</string>
<string>_getattr_</string>
<string>context</string>
<string>returned_value</string>
<string>_getitem_</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>CounterModule_getVaultInventoryList</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>
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
from Products.ERP5Type.Document import newTempBase\n from Products.ERP5Type.Document import newTempBase\n
\n \n
#context.log(\'CounterModule_getVaultTransactionList vault:\',vault)\n #context.log(\'CounterModule_getVaultTransactionList vault:\',vault)\n
def getTranslatedTitleFromCategoryUrl(category):\n
return context.portal_categories.getCategoryValue(category).getTranslatedTitle()\n
\n \n
def getTitleFromCategoryUrl(category):\n def getTitleFromCategoryUrl(category):\n
return context.portal_categories.getCategoryValue(category).getTitle()\n return context.portal_categories.getCategoryValue(category).getTitle()\n
...@@ -84,6 +86,7 @@ def getTitleFromCategoryUrl(category):\n ...@@ -84,6 +86,7 @@ def getTitleFromCategoryUrl(category):\n
def getVariationTitleList(variation_text):\n def getVariationTitleList(variation_text):\n
return [getTitleFromCategoryUrl(x) for x in variation_text.split(\'\\n\')]\n return [getTitleFromCategoryUrl(x) for x in variation_text.split(\'\\n\')]\n
\n \n
\n
resource_dict = {}\n resource_dict = {}\n
vault_dict = {}\n vault_dict = {}\n
vault_inventory_dict = {}\n vault_inventory_dict = {}\n
...@@ -155,15 +158,20 @@ for resource in resource_dict.keys():\n ...@@ -155,15 +158,20 @@ for resource in resource_dict.keys():\n
for variation in variation_text.split(\'\\n\'):\n for variation in variation_text.split(\'\\n\'):\n
if variation.startswith(\'cash_status\'):\n if variation.startswith(\'cash_status\'):\n
tmp_dict[\'cash_status\'] = variation\n tmp_dict[\'cash_status\'] = variation\n
tmp_dict[\'cash_status_title\'] = getTitleFromCategoryUrl(variation)\n
tmp_dict[\'cash_status_translated_title\'] = getTranslatedTitleFromCategoryUrl(variation)\n
elif variation.startswith(\'emission_letter\'):\n elif variation.startswith(\'emission_letter\'):\n
tmp_dict[\'emission_letter\'] = variation\n tmp_dict[\'emission_letter\'] = variation\n
tmp_dict[\'emission_letter_title\'] = getTitleFromCategoryUrl(variation)\n
elif variation.startswith(\'variation\'):\n elif variation.startswith(\'variation\'):\n
tmp_dict[\'variation\'] = variation\n tmp_dict[\'variation\'] = variation\n
tmp_dict[\'variation_title\'] = \' \'.join(getVariationTitleList(resource[1]))\n tmp_dict[\'variation_title\'] = getTitleFromCategoryUrl(variation)\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
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
tmp_dict[\'resource_translated_title\'] = resource_value.getTranslatedTitle()\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
...@@ -249,6 +257,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -249,6 +257,7 @@ return repr([x for x in total_inventory_list])\n
<string>kw</string> <string>kw</string>
<string>Products.ERP5Type.Document</string> <string>Products.ERP5Type.Document</string>
<string>newTempBase</string> <string>newTempBase</string>
<string>getTranslatedTitleFromCategoryUrl</string>
<string>getTitleFromCategoryUrl</string> <string>getTitleFromCategoryUrl</string>
<string>getVariationTitleList</string> <string>getVariationTitleList</string>
<string>resource_dict</string> <string>resource_dict</string>
......
...@@ -102,6 +102,8 @@ ...@@ -102,6 +102,8 @@
<value> <value>
<list> <list>
<string>listbox</string> <string>listbox</string>
<string>listbox_total_price</string>
<string>listbox_total_quantity</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -346,20 +346,24 @@ ...@@ -346,20 +346,24 @@
<value> <value>
<list> <list>
<tuple> <tuple>
<string>path</string> <string>resource_translated_title</string>
<string>Operation</string> <string>Resource</string>
</tuple> </tuple>
<tuple> <tuple>
<string>date</string> <string>price_currency_title</string>
<string>Date</string> <string>Currency</string>
</tuple> </tuple>
<tuple> <tuple>
<string>resource_title</string> <string>cash_status_translated_title</string>
<string>Resource</string> <string>Cash Status</string>
</tuple>
<tuple>
<string>emission_letter_title</string>
<string>Emission Letter</string>
</tuple> </tuple>
<tuple> <tuple>
<string>average_price</string> <string>variation_title</string>
<string>Price</string> <string>Variation</string>
</tuple> </tuple>
<tuple> <tuple>
<string>total_quantity</string> <string>total_quantity</string>
...@@ -369,14 +373,6 @@ ...@@ -369,14 +373,6 @@
<string>total_price</string> <string>total_price</string>
<string>Total Price</string> <string>Total Price</string>
</tuple> </tuple>
<tuple>
<string>variation_title</string>
<string>Variation</string>
</tuple>
<tuple>
<string>simulation_state</string>
<string>Simulatin State</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
...@@ -419,7 +415,16 @@ ...@@ -419,7 +415,16 @@
<item> <item>
<key> <string>editable_columns</string> </key> <key> <string>editable_columns</string> </key>
<value> <value>
<list/> <list>
<tuple>
<string>total_quantity</string>
<string>Quantity</string>
</tuple>
<tuple>
<string>total_price</string>
<string>Total Price</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -497,7 +502,12 @@ ...@@ -497,7 +502,12 @@
<item> <item>
<key> <string>sort</string> </key> <key> <string>sort</string> </key>
<value> <value>
<list/> <list>
<tuple>
<string>resource_title</string>
<string>resource_title</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -565,7 +575,7 @@ ...@@ -565,7 +575,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>method_name</string> </key> <key> <string>method_name</string> </key>
<value> <string>CounterModule_getVaultTransactionList</string> </value> <value> <string>CounterModule_getVaultInventoryList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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