From 4ce7af357317886cfd7f08e7b1e23c6a56d9f431 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 24 Nov 2014 10:51:23 +0100 Subject: [PATCH 1/6] [FIX] product: creation of reference uom Set a default value for factor when creating a new uom. Could not create a new UoM with type reference (if creates a reference uom, no need to pass a factor). Change the readonly filter to (type = bigger) to make the field writable for reference uom. This is needed to force the reset of the factor when switching of type (onchange_type). As the field was readonly, kept the old value for factor. --- addons/product/product.py | 1 + addons/product/product_view.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index ce5b9bacddf..abdbcaf4895 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -152,6 +152,7 @@ class product_uom(osv.osv): _defaults = { 'active': 1, 'rounding': 0.01, + 'factor': 1, 'uom_type': 'reference', } diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index a59a77c1357..f0908ddc46e 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -424,7 +424,7 @@ + 'readonly':[('uom_type','=','bigger')]}"/> - + - - - + + + @@ -52,14 +52,14 @@ - + - - - + + + From e2dd18f1e7304040974a81cfacce96848eb89719 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 26 Nov 2014 12:28:45 +0100 Subject: [PATCH 6/6] [FIX] mrp: prevent recursion from phantom boms with no lines if the bom is phantom and has no line, we attempt to find a new bom with the default product uom This is possible that we find the same bom that the current one In such a case, we must not explode, to avoid recursion. --- addons/mrp/mrp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 45b2bcbc047..67f36579f12 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -334,7 +334,7 @@ class mrp_bom(osv.osv): if bom.type == 'phantom' and not bom.bom_lines: newbom = self._bom_find(cr, uid, bom.product_id.id, bom.product_uom.id, properties) - if newbom: + if newbom and newbom != bom.id: res = self._bom_explode(cr, uid, self.browse(cr, uid, [newbom])[0], factor*bom.product_qty, properties, addthis=True, level=level+10) result = result + res[0] result2 = result2 + res[1]