From 693043f48bc19244e48d02f88a472811754b19c4 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine <arnaud.fontaine@nexedi.com> Date: Thu, 2 Jun 2011 14:10:33 +0900 Subject: [PATCH] Fix quantity unit conversion on ProductionOrder_viewMaterialConsumption. --- ...uctionOrder_getConsumptionMovementList.xml | 19 ++++++++++--------- bt5/erp5_mrp/bt/change_log | 3 +++ bt5/erp5_mrp/bt/revision | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bt5/erp5_mrp/SkinTemplateItem/portal_skins/erp5_mrp/ProductionOrder_getConsumptionMovementList.xml b/bt5/erp5_mrp/SkinTemplateItem/portal_skins/erp5_mrp/ProductionOrder_getConsumptionMovementList.xml index 70013a27a7..b1af0517bf 100644 --- a/bt5/erp5_mrp/SkinTemplateItem/portal_skins/erp5_mrp/ProductionOrder_getConsumptionMovementList.xml +++ b/bt5/erp5_mrp/SkinTemplateItem/portal_skins/erp5_mrp/ProductionOrder_getConsumptionMovementList.xml @@ -78,7 +78,6 @@ for inventory in context.portal_simulation.getFutureInventoryList(*args,**kwargs result_list = inventory_dict.values()\n consumption_dict = {}\n for movement in context.getMovementList():\n - movement_quantity_unit = movement.getQuantityUnit()\n movement_quantity = movement.getQuantity()\n movement_destination = movement.getDestination()\n \n @@ -90,22 +89,24 @@ for movement in context.getMovementList():\n inventory_dict_key = material_resource_uid, \\\n tuple(sorted(material.getVariationCategoryList())), \\\n movement_destination\n +\n + quantity = material.getQuantity()\n \n try:\n obj = inventory_dict[inventory_dict_key]\n except KeyError:\n obj = material\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 - quantity = material.getResourceValue().convertQuantity(material.getQuantity(),\n - material_quantity_unit,\n - movement_quantity_unit)\n + inventory_quantity_unit = obj.getQuantityUnit()\n + quantity_unit = material.getQuantityUnit()\n + if quantity_unit != inventory_quantity_unit:\n + quantity = material.getResourceValue().convertQuantity(quantity,\n + quantity_unit,\n + inventory_quantity_unit)\n \n - consumption_dict[obj.getUid()] = quantity * movement_quantity\n + if quantity:\n + consumption_dict[obj.getUid()] = quantity * movement_quantity\n \n context.REQUEST.set(\'consumption_dict\', consumption_dict)\n return result_list\n diff --git a/bt5/erp5_mrp/bt/change_log b/bt5/erp5_mrp/bt/change_log index f13dbf1eea..20665dde85 100644 --- a/bt5/erp5_mrp/bt/change_log +++ b/bt5/erp5_mrp/bt/change_log @@ -1,3 +1,6 @@ +2011-06-02 arnaud.fontaine +* Fix quantity unit conversion on ProductionOrder_viewMaterialConsumption. + 2011-06-01 arnaud.fontaine * Fix ProductionOrder_viewMaterialConsumption and display materials even when not in the inventory. diff --git a/bt5/erp5_mrp/bt/revision b/bt5/erp5_mrp/bt/revision index 1b6db1e863..4754f24761 100644 --- a/bt5/erp5_mrp/bt/revision +++ b/bt5/erp5_mrp/bt/revision @@ -1 +1 @@ -460 \ No newline at end of file +461 \ No newline at end of file -- 2.30.9