From 2d407de5d4eddada0d46b1ed2b0d43fdc749deda Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 29 Jul 2015 23:49:31 +0200 Subject: [PATCH] [FIX] mrp_byproduct: remove bom uos when calculating byproduct In commit 43977deb7 a mrp.bom was transformed from a recursive model which may contains BoMs containing BoMs and so on, to a simpler model containing a line of products (mrp.bom containing mrp.bom.line). mrp_byproduct wasn't changed to reflect on this change which caused an error. Since there is no product Unit of Sale on a byproduct, the current behaviour causing the error of trying to multiply based on the Unit of Sale of the BoM product has been removed. closes #7806 opw-645639 opw-645640 --- addons/mrp_byproduct/mrp_byproduct.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/addons/mrp_byproduct/mrp_byproduct.py b/addons/mrp_byproduct/mrp_byproduct.py index fa7c0784052..17b3a63c458 100644 --- a/addons/mrp_byproduct/mrp_byproduct.py +++ b/addons/mrp_byproduct/mrp_byproduct.py @@ -94,23 +94,15 @@ class mrp_production(osv.osv): for sub_product in production.bom_id.sub_products: product_uom_factor = product_uom_obj._compute_qty(cr, uid, production.product_uom.id, production.product_qty, production.bom_id.product_uom.id) qty1 = sub_product.product_qty - qty2 = production.product_uos and production.product_uos_qty or False - product_uos_factor = 0.0 - if qty2 and production.bom_id.product_uos.id: - product_uos_factor = product_uom_obj._compute_qty(cr, uid, production.product_uos.id, production.product_uos_qty, production.bom_id.product_uos.id) if sub_product.subproduct_type == 'variable': if production.product_qty: qty1 *= product_uom_factor / (production.bom_id.product_qty or 1.0) - if production.product_uos_qty: - qty2 *= product_uos_factor / (production.bom_id.product_uos_qty or 1.0) data = { 'name': 'PROD:'+production.name, 'date': production.date_planned, 'product_id': sub_product.product_id.id, 'product_uom_qty': qty1, 'product_uom': sub_product.product_uom.id, - 'product_uos_qty': qty2, - 'product_uos': production.product_uos and production.product_uos.id or False, 'location_id': source, 'location_dest_id': production.location_dest_id.id, 'move_dest_id': production.move_prod_id.id,