Commit 269fd1d0 authored by Sebastien Robin's avatar Sebastien Robin

Specify the at_date to getCurrentInventory while checking inventories

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17652 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 53e58930
...@@ -87,6 +87,7 @@ line_list = []\n ...@@ -87,6 +87,7 @@ line_list = []\n
resource_dict = {}\n resource_dict = {}\n
node_dict = {}\n node_dict = {}\n
variation_text_dict = {}\n variation_text_dict = {}\n
start_date = context.getStartDate()\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
if source is None:\n if source is None:\n
...@@ -122,6 +123,7 @@ def checkActivities(source_counter):\n ...@@ -122,6 +123,7 @@ def checkActivities(source_counter):\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
inventory_list = context.portal_simulation.getCurrentInventoryList(\n inventory_list = context.portal_simulation.getCurrentInventoryList(\n
at_date=start_date,\n
group_by_variation=1,\n group_by_variation=1,\n
group_by_node=1,\n group_by_node=1,\n
group_by_resource=1,\n group_by_resource=1,\n
...@@ -169,10 +171,12 @@ for line in line_list :\n ...@@ -169,10 +171,12 @@ for line in line_list :\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
msg = Message(domain=\'ui\', message=\'Insufficient balance for $resource, letter $letter, status $status and variation $variation\', mapping={\'resource\':cell.getResourceTranslatedTitle(),\n msg = Message(domain=\'ui\',\n
\'letter\': cell.getEmissionLetterTitle(),\n message=\'Insufficient balance for $resource, letter $letter, status $status and variation $variation\',\n
\'status\': cell.getCashStatusTranslatedTitle(),\n mapping={\'resource\':cell.getResourceTranslatedTitle(),\n
\'variation\':cell.getVariationTitle()})\n \'letter\': cell.getEmissionLetterTitle(),\n
\'status\': cell.getCashStatusTranslatedTitle(),\n
\'variation\':cell.getVariationTitle()})\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
else :\n else :\n
raise ValueError, \'This script must not be used on movements without cells. It is deprecated and dangerous, therefor it raises.\'\n raise ValueError, \'This script must not be used on movements without cells. It is deprecated and dangerous, therefor it raises.\'\n
...@@ -254,6 +258,7 @@ return 0\n ...@@ -254,6 +258,7 @@ return 0\n
<string>resource_dict</string> <string>resource_dict</string>
<string>node_dict</string> <string>node_dict</string>
<string>variation_text_dict</string> <string>variation_text_dict</string>
<string>start_date</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>l</string> <string>l</string>
<string>None</string> <string>None</string>
......
378 379
\ No newline at end of file \ 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