Commit 381ba4d7 authored by Aurel's avatar Aurel

add parameter to pass check of baobab source on line

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7168 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c90c4e28
...@@ -81,19 +81,20 @@ requested_dict = {}\n ...@@ -81,19 +81,20 @@ requested_dict = {}\n
\n \n
# test all movement\n # test all movement\n
tmp_list = context.contentValues(filter={\'portal_type\': portal_type})\n tmp_list = context.contentValues(filter={\'portal_type\': portal_type})\n
context.log(\'tmp_list\', str((tmp_list, portal_type, context)))\n #context.log(\'tmp_list\', str((tmp_list, portal_type, context)))\n
#context.log(\'source\',source)\n
line_list = []\n line_list = []\n
for l in tmp_list :\n for l in tmp_list :\n
# The source can be different for every line (due to getBaobabSource approach)\n # The source can be different for every line (due to getBaobabSource approach)\n
source_counter = source or l.getBaobabSource()\n source_counter = source or l.getBaobabSource()\n
# test if resource is a currency_cash\n # test if resource is a currency_cash\n
try: \n try:\n
if (l.getResourceValue().getPortalType() in currency_cash_portal_type_list) \\\n if (l.getResourceValue().getPortalType() in currency_cash_portal_type_list) \\\n
and (l.getBaobabSource() == source_counter) :\n and (same_source or l.getBaobabSource() == source_counter) :\n
line_list.append(l)\n line_list.append(l)\n
except (AttributeError, KeyError): \n except (AttributeError, KeyError):\n
pass\n pass\n
\n #context.log("line list", line_list)\n
if len(line_list) == 0 :\n if len(line_list) == 0 :\n
# no resource\n # no resource\n
return 2\n return 2\n
...@@ -105,11 +106,11 @@ for line in line_list :\n ...@@ -105,11 +106,11 @@ for line in line_list :\n
if line.hasCellContent() :\n if line.hasCellContent() :\n
for cell in line.objectValues() :\n for cell in line.objectValues() :\n
variation_text = cell.getVariationText()\n variation_text = cell.getVariationText()\n
#context.log(\'check cell : \', str((source_counter, line_resource, variation_text)))\n # context.log(\'check cell : \', str((source_counter, line_resource, variation_text)))\n
inventory_value = context.portal_simulation.getFutureInventory(node=source_counter, resource = line_resource,\n inventory_value = context.portal_simulation.getFutureInventory(node=source_counter, resource = line_resource,\n
variation_text = variation_text)\n variation_text = variation_text)\n
#context.log(\'cell quantity\', cell.getQuantity())\n # context.log(\'cell quantity\', cell.getQuantity())\n
#context.log(\'inventory value\', inventory_value)\n # context.log(\'inventory value\', inventory_value)\n
if inventory_value - cell.getQuantity() < 0:\n if inventory_value - cell.getQuantity() < 0:\n
return 1\n return 1\n
\n \n
...@@ -147,7 +148,7 @@ return 0\n ...@@ -147,7 +148,7 @@ return 0\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>source=None, portal_type=None, debug=0</string> </value> <value> <string>source=None, portal_type=None, same_source=0, debug=0</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -167,7 +168,7 @@ return 0\n ...@@ -167,7 +168,7 @@ return 0\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>3</int> </value> <value> <int>4</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -175,6 +176,7 @@ return 0\n ...@@ -175,6 +176,7 @@ return 0\n
<tuple> <tuple>
<string>source</string> <string>source</string>
<string>portal_type</string> <string>portal_type</string>
<string>same_source</string>
<string>debug</string> <string>debug</string>
<string>currency_cash_portal_type_list</string> <string>currency_cash_portal_type_list</string>
<string>inventory_dict</string> <string>inventory_dict</string>
...@@ -182,7 +184,6 @@ return 0\n ...@@ -182,7 +184,6 @@ return 0\n
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>tmp_list</string> <string>tmp_list</string>
<string>str</string>
<string>line_list</string> <string>line_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>l</string> <string>l</string>
...@@ -210,6 +211,7 @@ return 0\n ...@@ -210,6 +211,7 @@ return 0\n
<none/> <none/>
<none/> <none/>
<int>0</int> <int>0</int>
<int>0</int>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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