Commit 693043f4 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Fix quantity unit conversion on ProductionOrder_viewMaterialConsumption.

parent e2f4550e
...@@ -78,7 +78,6 @@ for inventory in context.portal_simulation.getFutureInventoryList(*args,**kwargs ...@@ -78,7 +78,6 @@ for inventory in context.portal_simulation.getFutureInventoryList(*args,**kwargs
result_list = inventory_dict.values()\n result_list = inventory_dict.values()\n
consumption_dict = {}\n consumption_dict = {}\n
for movement in context.getMovementList():\n for movement in context.getMovementList():\n
movement_quantity_unit = movement.getQuantityUnit()\n
movement_quantity = movement.getQuantity()\n movement_quantity = movement.getQuantity()\n
movement_destination = movement.getDestination()\n movement_destination = movement.getDestination()\n
\n \n
...@@ -90,22 +89,24 @@ for movement in context.getMovementList():\n ...@@ -90,22 +89,24 @@ for movement in context.getMovementList():\n
inventory_dict_key = material_resource_uid, \\\n inventory_dict_key = material_resource_uid, \\\n
tuple(sorted(material.getVariationCategoryList())), \\\n tuple(sorted(material.getVariationCategoryList())), \\\n
movement_destination\n movement_destination\n
\n
quantity = material.getQuantity()\n
\n \n
try:\n try:\n
obj = inventory_dict[inventory_dict_key]\n obj = inventory_dict[inventory_dict_key]\n
except KeyError:\n except KeyError:\n
obj = material\n obj = material\n
result_list.append(obj)\n result_list.append(obj)\n
\n
material_quantity_unit = material.getQuantityUnit()\n
if movement_quantity_unit == material_quantity_unit:\n
quantity = material.getQuantity()\n
else:\n else:\n
quantity = material.getResourceValue().convertQuantity(material.getQuantity(),\n inventory_quantity_unit = obj.getQuantityUnit()\n
material_quantity_unit,\n quantity_unit = material.getQuantityUnit()\n
movement_quantity_unit)\n if quantity_unit != inventory_quantity_unit:\n
quantity = material.getResourceValue().convertQuantity(quantity,\n
quantity_unit,\n
inventory_quantity_unit)\n
\n \n
consumption_dict[obj.getUid()] = quantity * movement_quantity\n if quantity:\n
consumption_dict[obj.getUid()] = quantity * movement_quantity\n
\n \n
context.REQUEST.set(\'consumption_dict\', consumption_dict)\n context.REQUEST.set(\'consumption_dict\', consumption_dict)\n
return result_list\n return result_list\n
......
2011-06-02 arnaud.fontaine
* Fix quantity unit conversion on ProductionOrder_viewMaterialConsumption.
2011-06-01 arnaud.fontaine 2011-06-01 arnaud.fontaine
* Fix ProductionOrder_viewMaterialConsumption and display materials even when not in the inventory. * Fix ProductionOrder_viewMaterialConsumption and display materials even when not in the inventory.
......
460 461
\ 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