[FIX] mrp: prevent recursion from phantom boms with no lines
authorDenis Ledoux <dle@odoo.com>
Wed, 26 Nov 2014 11:28:45 +0000 (12:28 +0100)
committerDenis Ledoux <dle@odoo.com>
Wed, 26 Nov 2014 11:34:45 +0000 (12:34 +0100)
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

index 45b2bcb..67f3657 100644 (file)
@@ -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]