Commit 3a40f0f5 authored by Vincent Pelletier's avatar Vincent Pelletier

Inventory input parameters and output values do not use consistent names, so 2...

Inventory input parameters and output values do not use consistent names, so 2 distinct lists must be used - but they must b sorted in a consistent way.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15528 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 99a8e383
...@@ -130,13 +130,14 @@ inventory_list = context.portal_simulation.getCurrentInventoryList(\n ...@@ -130,13 +130,14 @@ inventory_list = context.portal_simulation.getCurrentInventoryList(\n
variation_text=variation_text_dict.keys())\n variation_text=variation_text_dict.keys())\n
\n \n
inventory_dict = {}\n inventory_dict = {}\n
inventory_key_order = [\'node\', \'resource\', \'variation_text\']\n inventory_column_id_order = [\'node_relative_url\', \'resource_relative_url\', \'variation_text\']\n
inventory_parameter_id_order = [\'node\', \'resource\', \'variation_text\']\n
for inventory_line in inventory_list:\n for inventory_line in inventory_list:\n
inventory_key = tuple([inventory_line[x] for x in inventory_key_order])\n inventory_key = tuple([inventory_line[x] for x in inventory_column_id_order])\n
inventory_dict[inventory_key] = inventory_line[\'inventory\']\n inventory_dict[inventory_key] = inventory_line[\'inventory\']\n
\n \n
def getCurrentInventory(**criterion_dict):\n def getCurrentInventory(**criterion_dict):\n
inventory_key = tuple([criterion_dict[x] for x in inventory_key_order])\n inventory_key = tuple([criterion_dict[x] for x in inventory_parameter_id_order])\n
return inventory_dict.get(inventory_key, 0)\n return inventory_dict.get(inventory_key, 0)\n
\n \n
for line in line_list :\n for line in line_list :\n
...@@ -266,7 +267,8 @@ return 0\n ...@@ -266,7 +267,8 @@ return 0\n
<string>activity_tool</string> <string>activity_tool</string>
<string>checkActivities</string> <string>checkActivities</string>
<string>inventory_list</string> <string>inventory_list</string>
<string>inventory_key_order</string> <string>inventory_column_id_order</string>
<string>inventory_parameter_id_order</string>
<string>inventory_line</string> <string>inventory_line</string>
<string>tuple</string> <string>tuple</string>
<string>append</string> <string>append</string>
......
335 337
\ 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