From 2f5d681135566bef7fd27dab683642486b249ef1 Mon Sep 17 00:00:00 2001 From: Wolfgang Taferner Date: Sat, 23 May 2015 10:20:06 +0200 Subject: [PATCH] [FIX] product_extended: cost price computation from BOM having lines with products using a different UOM for sales and purchases If a product does have a (different) purchase uom, we should first take it as a base for calculating prices as the standard price relates to it and not the sale (normal) uom. Closes #6829 opw-640616 --- addons/product_extended/product_extended.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/product_extended/product_extended.py b/addons/product_extended/product_extended.py index a8bcea6e144..fd7c3084b25 100644 --- a/addons/product_extended/product_extended.py +++ b/addons/product_extended/product_extended.py @@ -76,8 +76,9 @@ class product_template(osv.osv): for sbom in bom.bom_line_ids: my_qty = sbom.product_qty if not sbom.attribute_value_ids: + bom_product = sbom.product_id # No attribute_value_ids means the bom line is not variant specific - price += uom_obj._compute_price(cr, uid, sbom.product_id.uom_id.id, sbom.product_id.standard_price, sbom.product_uom.id) * my_qty + price += uom_obj._compute_price(cr, uid, bom_product.uom_po_id and bom_product.uom_po_id.id or bom_product.uom_id.id, bom_product.standard_price, sbom.product_uom.id) * my_qty if bom.routing_id: for wline in bom.routing_id.workcenter_lines: