Merge lp:~therp-nl/openobject-addons/lp1155569 into lp:openobject-addons

Proposed by Holger Brunn (Therp)
Status: Needs review
Proposed branch: lp:~therp-nl/openobject-addons/lp1155569
Merge into: lp:openobject-addons
Diff against target: 27 lines (+4/-6)
1 file modified
mrp/mrp.py (+4/-6)
To merge this branch: bzr merge lp:~therp-nl/openobject-addons/lp1155569
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+153536@code.launchpad.net

Commit message

[FIX] don't include adjacent bom's products into check for recursion

To post a comment you must log in.

Unmerged revisions

8796. By Holger Brunn (Therp)

[FIX] don't include adjacent bom's products into check for recursion

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py 2013-03-05 11:14:50 +0000
+++ mrp/mrp.py 2013-03-15 11:48:37 +0000
@@ -244,19 +244,17 @@
244 return True244 return True
245245
246 def _check_product(self, cr, uid, ids, context=None):246 def _check_product(self, cr, uid, ids, context=None):
247 all_prod = []
248 boms = self.browse(cr, uid, ids, context=context)247 boms = self.browse(cr, uid, ids, context=context)
249 def check_bom(boms):248 def check_bom(boms, all_prod):
250 res = True249 res = True
251 for bom in boms:250 for bom in boms:
252 if bom.product_id.id in all_prod:251 if bom.product_id.id in all_prod:
253 res = res and False252 return False
254 all_prod.append(bom.product_id.id)
255 lines = bom.bom_lines253 lines = bom.bom_lines
256 if lines:254 if lines:
257 res = res and check_bom([bom_id for bom_id in lines if bom_id not in boms])255 res = res and check_bom([bom_id for bom_id in lines if bom_id not in boms], all_prod + [bom.product_id.id])
258 return res256 return res
259 return check_bom(boms)257 return check_bom(boms, [])
260258
261 _constraints = [259 _constraints = [
262 (_check_recursion, 'Error ! You cannot create recursive BoM.', ['parent_id']),260 (_check_recursion, 'Error ! You cannot create recursive BoM.', ['parent_id']),

Subscribers

People subscribed via source and target branches

to all changes: