Commit 6fe23c82 authored by Sebastien Robin's avatar Sebastien Robin

small changes

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8338 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 943badb4
...@@ -88,10 +88,10 @@ elif my_choice == \'cash_status_item\':\n ...@@ -88,10 +88,10 @@ elif my_choice == \'cash_status_item\':\n
if my_list is None:\n if my_list is None:\n
my_list = getattr(request,\'field_my_cash_status_list\',None) # Find Emission letter on the REQUEST\n my_list = getattr(request,\'field_my_cash_status_list\',None) # Find Emission letter on the REQUEST\n
if my_list is not None:\n if my_list is not None:\n
return_value = [x for x in context.portal_categories.cash_status.getCategoryChildTitleItemList()\n return_value = [x for x in context.portal_categories.cash_status.getCategoryChildTranslatedTitleItemList()\n
if x[1] in my_list]\n if x[1] in my_list]\n
else:\n else:\n
return_value = [x for x in context.portal_categories.cash_status.getCategoryChildTitleItemList()]\n return_value = [x for x in context.portal_categories.cash_status.getCategoryChildTranslatedTitleItemList()]\n
elif my_choice == \'cash_status_default_value\':\n elif my_choice == \'cash_status_default_value\':\n
return_value = getattr(request,\'my_cash_status_list\',None) # Find cash Status on the REQUEST\n return_value = getattr(request,\'my_cash_status_list\',None) # Find cash Status on the REQUEST\n
return_value = return_value[1]\n return_value = return_value[1]\n
......
...@@ -77,7 +77,7 @@ if len(rate_list) > 0:\n ...@@ -77,7 +77,7 @@ if len(rate_list) > 0:\n
if rate is None:\n if rate is None:\n
return None\n return None\n
\n \n
base_price = context.getBasePrice()\n base_price = context.getSourceTotalAssetPrice()\n
if base_price is None:\n if base_price is None:\n
return None\n return None\n
\n \n
...@@ -87,8 +87,7 @@ commission_ratio = context.getDiscountRatio()\n ...@@ -87,8 +87,7 @@ commission_ratio = context.getDiscountRatio()\n
commission_price = context.getDiscount()\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 if commission_ratio is not None and commission_ratio !=0 and commission_price is not None and commission_price !=0:\n
return None\n return None\n
if (commission_ratio is None or commission_ratio == 0) and (commission_price is None or commission_price == 0):\n # Do not return if commission_ratio and comission_price is 0 or Null, sometimes we have no commission\n
return None\n
\n \n
if commission_ratio is not None:\n if commission_ratio is not None:\n
commission_value = commission_ratio * price\n commission_value = commission_ratio * price\n
......
...@@ -77,7 +77,7 @@ if len(rate_list) > 0:\n ...@@ -77,7 +77,7 @@ if len(rate_list) > 0:\n
if rate is None:\n if rate is None:\n
return None\n return None\n
\n \n
base_price = context.getBasePrice()\n base_price = context.getSourceTotalAssetPrice()\n
if base_price is None:\n if base_price is None:\n
return None\n return None\n
\n \n
......
...@@ -68,9 +68,15 @@ ...@@ -68,9 +68,15 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Document import newTempBase\n <value> <string># This script returns a list of resources that we can find in a particular stock point.\n
# - vault : the stock we are intested in\n
# - at_date : give the stock for a particular date\n
# - from_date : usefull with at date in order to know the sum of input and output\n
# between two dates\n
\n \n
context.log(\'CounterModule_getVaultTransactionList vault:\',vault)\n from Products.ERP5Type.Document import newTempBase\n
\n
#context.log(\'CounterModule_getVaultTransactionList vault:\',vault)\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
...@@ -88,15 +94,25 @@ vault_inventory_dict[vault_url] = {}\n ...@@ -88,15 +94,25 @@ vault_inventory_dict[vault_url] = {}\n
inventory_kw = {}\n inventory_kw = {}\n
inventory_kw[\'group_by_variation\'] = 1\n inventory_kw[\'group_by_variation\'] = 1\n
inventory_kw[\'group_by_resource\'] = 1\n inventory_kw[\'group_by_resource\'] = 1\n
# add to get by portal type inventory\n
if kw.has_key("portal_type"):\n
inventory_kw[\'portal_type\'] = kw[\'portal_type\']\n
\n
if at_date is not None:\n
inventory_kw[\'at_date\'] = at_date\n
vault_inventory_list = context.portal_simulation.getCurrentInventoryList( node_category=vault\n vault_inventory_list = context.portal_simulation.getCurrentInventoryList( node_category=vault\n
#, resource_category=\'currency/\' + context.Baobab_getPortalReferenceCurrencyID()\n
, ignore_variation=0\n , ignore_variation=0\n
,**inventory_kw\n ,**inventory_kw\n
)\n )\n
context.log(\'len(vault_inventory_list:\',len(vault_inventory_list))\n #context.log(\'CounterMOdule_getVaultTransactionList, sql src:\',context.portal_simulation.getCurrentInventoryList( node_category=vault\n
# , ignore_variation=0,src__=1\n
# ,**inventory_kw\n
# ))\n
\n
#context.log(\'len(vault_inventory_list:\',len(vault_inventory_list))\n
for vault_inventory in vault_inventory_list:\n 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 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
...@@ -113,7 +129,7 @@ for vault_inventory in vault_inventory_list:\n ...@@ -113,7 +129,7 @@ for vault_inventory in vault_inventory_list:\n
if column_names == 1:\n if column_names == 1:\n
column_list = [(\'resource\', \'Resource\'), (\'variation_text\', \'Year\')]\n column_list = [(\'resource\', \'Resource\'), (\'variation_text\', \'Year\')]\n
for vault in vault_dict.keys():\n for vault in vault_dict.keys():\n
context.log(\'getTitleFromCategoryUrl(vault)\',getTitleFromCategoryUrl(vault))\n #context.log(\'getTitleFromCategoryUrl(vault)\',getTitleFromCategoryUrl(vault))\n
column_list.extend([\n column_list.extend([\n
(vault + \'_quantity\', getTitleFromCategoryUrl(vault) + \' Quantity\'),\n (vault + \'_quantity\', getTitleFromCategoryUrl(vault) + \' Quantity\'),\n
(vault + \'_total_price\', getTitleFromCategoryUrl(vault) + \' TotalPrice\')\n (vault + \'_total_price\', getTitleFromCategoryUrl(vault) + \' TotalPrice\')\n
...@@ -123,8 +139,8 @@ if column_names == 1:\n ...@@ -123,8 +139,8 @@ if column_names == 1:\n
\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
context.log(\'vault_inventory_dict\',vault_inventory_dict)\n #context.log(\'vault_inventory_dict\',vault_inventory_dict)\n
\n \n
i = 0\n i = 0\n
#for resource in context.Baobab_sortResourceTitleList(resource_dict.keys()):\n #for resource in context.Baobab_sortResourceTitleList(resource_dict.keys()):\n
...@@ -194,7 +210,7 @@ return repr([x for x in total_inventory_list])\n ...@@ -194,7 +210,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,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, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -214,20 +230,20 @@ return repr([x for x in total_inventory_list])\n ...@@ -214,20 +230,20 @@ 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>3</int> </value> <value> <int>5</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>vault</string> <string>vault</string>
<string>at_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>kw</string> <string>kw</string>
<string>Products.ERP5Type.Document</string> <string>Products.ERP5Type.Document</string>
<string>newTempBase</string> <string>newTempBase</string>
<string>_getattr_</string>
<string>context</string>
<string>getTitleFromCategoryUrl</string> <string>getTitleFromCategoryUrl</string>
<string>getVariationTitleList</string> <string>getVariationTitleList</string>
<string>resource_dict</string> <string>resource_dict</string>
...@@ -236,15 +252,16 @@ return repr([x for x in total_inventory_list])\n ...@@ -236,15 +252,16 @@ return repr([x for x in total_inventory_list])\n
<string>vault_url</string> <string>vault_url</string>
<string>_write_</string> <string>_write_</string>
<string>inventory_kw</string> <string>inventory_kw</string>
<string>_getattr_</string>
<string>_getitem_</string>
<string>None</string>
<string>_apply_</string> <string>_apply_</string>
<string>context</string>
<string>vault_inventory_list</string> <string>vault_inventory_list</string>
<string>len</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>vault_inventory</string> <string>vault_inventory</string>
<string>resource</string> <string>resource</string>
<string>_getitem_</string>
<string>total_quantity</string> <string>total_quantity</string>
<string>None</string>
<string>total_price</string> <string>total_price</string>
<string>column_list</string> <string>column_list</string>
<string>total_inventory_list</string> <string>total_inventory_list</string>
...@@ -273,6 +290,8 @@ return repr([x for x in total_inventory_list])\n ...@@ -273,6 +290,8 @@ return repr([x for x in total_inventory_list])\n
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple> <tuple>
<none/>
<none/>
<none/> <none/>
<none/> <none/>
<int>0</int> <int>0</int>
......
...@@ -68,13 +68,15 @@ ...@@ -68,13 +68,15 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>price = context.CurrencyExchange_getExchangeRateList()[1] * context.getBasePrice()\n <value> <string>price = context.ERP5Banking_getExchangeValue()\n
\n \n
commission_ratio = context.getDiscountRatio()\n commission_ratio = context.getDiscountRatio()\n
commission_price = context.getDiscount()\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 if commission_ratio is not None and commission_ratio !=0 and commission_price is not None and commission_price !=0:\n
return None\n return None\n
if (commission_ratio is None or commission_ratio == 0) and (commission_price is None or commission_price == 0):\n if commission_ratio == 0 or commission_price == 0:\n
return price\n
if commission_ratio is None and commission_price is None:\n
return None\n return None\n
\n \n
if commission_ratio is not None:\n if commission_ratio is not None:\n
...@@ -132,7 +134,6 @@ return quantity\n ...@@ -132,7 +134,6 @@ return quantity\n
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>_getitem_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>price</string> <string>price</string>
......
...@@ -80,6 +80,8 @@ ...@@ -80,6 +80,8 @@
# Delivery_getVaultItemList utilis\xc3\xa9 dans le TALES de my_source dans le formulaire\n # Delivery_getVaultItemList utilis\xc3\xa9 dans le TALES de my_source dans le formulaire\n
# user_site = 1 : Permet de s\xc3\xa9lectionner uniquement les encaisses des sites auquels l\'user est affect\xc3\xa9,\n # user_site = 1 : Permet de s\xc3\xa9lectionner uniquement les encaisses des sites auquels l\'user est affect\xc3\xa9,\n
# au lieu des encaisses de tous le sites\n # au lieu des encaisses de tous le sites\n
# owner_site = 1 : Permet de s\xc3\xa9lectionner uniquement les encaisses des sites auquels le propri\xc3\xa9taire du document est affect\xc3\xa9,\n
# au lieu des encaisses de tous le sites\n
# leaf_node = 1 : S\xc3\xa9lectionne uniquement les noeuds qui sont des feuilles de l\'arbre (qui n\'ont pas de sous-cat\xc3\xa9gories)\n # leaf_node = 1 : S\xc3\xa9lectionne uniquement les noeuds qui sont des feuilles de l\'arbre (qui n\'ont pas de sous-cat\xc3\xa9gories)\n
# strict_membership = 0 : Appartenance stricte. Si vault_type=\'site\', on s\xc3\xa9lectionnera \'site/agence/principale/paris\',\n # strict_membership = 0 : Appartenance stricte. Si vault_type=\'site\', on s\xc3\xa9lectionnera \'site/agence/principale/paris\',\n
# mais pas \'site/agence/principale/paris/caveau\', \'site/agence/principale/paris/surface\' et\n # mais pas \'site/agence/principale/paris/caveau\', \'site/agence/principale/paris/surface\' et\n
...@@ -223,8 +225,11 @@ if vault_type is None:\n ...@@ -223,8 +225,11 @@ if vault_type is None:\n
else:\n else:\n
assignment_list = None\n assignment_list = None\n
\n \n
if user_site == 1:\n if user_site == 1 or owner_site==1:\n
site_list = context.Baobab_getUserAssignedSiteList()\n if owner_site:\n
site_list = context.Baobab_getUserAssignedSiteList(user_id=context.owner_info()[\'id\'])\n
elif user_site:\n
site_list = context.Baobab_getUserAssignedSiteList()\n
# even if we are on a counter, we can see every thing in the same agency\n # even if we are on a counter, we can see every thing in the same agency\n
new_site_list = []\n new_site_list = []\n
for site in site_list:\n for site in site_list:\n
...@@ -282,7 +287,7 @@ return [(\'\', \'\')] + list(vault_list)\n ...@@ -282,7 +287,7 @@ return [(\'\', \'\')] + list(vault_list)\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>vault_type=None, exclude_vault_type=None, current_url=None, user_site=1, leaf_node=1, strict_membership=0, with_base=1, all=0, base_site=None</string> </value> <value> <string>vault_type=None, exclude_vault_type=None, current_url=None, user_site=1, leaf_node=1, strict_membership=0, with_base=1, all=0, base_site=None, owner_site=0</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
...@@ -310,7 +315,7 @@ return [(\'\', \'\')] + list(vault_list)\n ...@@ -310,7 +315,7 @@ return [(\'\', \'\')] + list(vault_list)\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>9</int> </value> <value> <int>10</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -325,6 +330,7 @@ return [(\'\', \'\')] + list(vault_list)\n ...@@ -325,6 +330,7 @@ return [(\'\', \'\')] + list(vault_list)\n
<string>with_base</string> <string>with_base</string>
<string>all</string> <string>all</string>
<string>base_site</string> <string>base_site</string>
<string>owner_site</string>
<string>Products.ERP5Type.Cache</string> <string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string> <string>CachingMethod</string>
<string>None</string> <string>None</string>
...@@ -332,6 +338,7 @@ return [(\'\', \'\')] + list(vault_list)\n ...@@ -332,6 +338,7 @@ return [(\'\', \'\')] + list(vault_list)\n
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>assignment_list</string> <string>assignment_list</string>
<string>_getitem_</string>
<string>site_list</string> <string>site_list</string>
<string>new_site_list</string> <string>new_site_list</string>
<string>_getiter_</string> <string>_getiter_</string>
...@@ -341,7 +348,6 @@ return [(\'\', \'\')] + list(vault_list)\n ...@@ -341,7 +348,6 @@ return [(\'\', \'\')] + list(vault_list)\n
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>x</string> <string>x</string>
<string>_getitem_</string>
<string>list</string> <string>list</string>
</tuple> </tuple>
</value> </value>
...@@ -364,6 +370,7 @@ return [(\'\', \'\')] + list(vault_list)\n ...@@ -364,6 +370,7 @@ return [(\'\', \'\')] + list(vault_list)\n
<int>1</int> <int>1</int>
<int>0</int> <int>0</int>
<none/> <none/>
<int>0</int>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -75,7 +75,7 @@ rate = None\n ...@@ -75,7 +75,7 @@ rate = None\n
if len(rate_list) > 0:\n if len(rate_list) > 0:\n
rate = rate_list[1]\n rate = rate_list[1]\n
\n \n
price = context.getBasePrice()\n price = context.getSourceTotalAssetPrice()\n
\n \n
if None in (rate, price):\n if None in (rate, price):\n
return None\n return None\n
......
2006-06-16 seb
* Added work done by Aurelien on fast input
* Some minor changes
2006-06-02 aurel
* add vault type base category to category
2006-05-18 aurel 2006-05-18 aurel
* update Delivery_getVaultItemList to take new categories into account and fix Baobab_getResourceVintageList * update Delivery_getVaultItemList to take new categories into account and fix Baobab_getResourceVintageList
......
Cash Delivery Cell | variation Cash Delivery Cell | variation
Category | vault_type
Checkbook | check_amount Checkbook | check_amount
Checkbook | resource Checkbook | resource
Container Cell | cash_status Container Cell | cash_status
......
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