From 3ec0353d9d8e59015348170062ba79ce93fff99a Mon Sep 17 00:00:00 2001 From: "hbrunn@therp.nl" Date: Thu, 20 Jun 2013 06:37:55 +0000 Subject: [PATCH] [MRG] [FIX] don't include adjacent bom's products into check for recursion (closes lp:1155569) https://launchpad.net/bugs/1155569 --- addons/mrp/mrp.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index e8e1887caf85e..012a45076c3e6 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -247,19 +247,17 @@ def _check_recursion(self, cr, uid, ids, context=None): return True def _check_product(self, cr, uid, ids, context=None): - all_prod = [] boms = self.browse(cr, uid, ids, context=context) - def check_bom(boms): + def check_bom(boms, all_prod): res = True for bom in boms: if bom.product_id.id in all_prod: - res = res and False - all_prod.append(bom.product_id.id) + return False lines = bom.bom_lines if lines: - res = res and check_bom([bom_id for bom_id in lines if bom_id not in boms]) + res = res and check_bom([bom_id for bom_id in lines if bom_id not in boms], all_prod + [bom.product_id.id]) return res - return check_bom(boms) + return check_bom(boms, []) _constraints = [ (_check_recursion, 'Error ! You cannot create recursive BoM.', ['parent_id']),