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
1=== modified file 'mrp/mrp.py'
2--- mrp/mrp.py 2013-03-05 11:14:50 +0000
3+++ mrp/mrp.py 2013-03-15 11:48:37 +0000
4@@ -244,19 +244,17 @@
5 return True
6
7 def _check_product(self, cr, uid, ids, context=None):
8- all_prod = []
9 boms = self.browse(cr, uid, ids, context=context)
10- def check_bom(boms):
11+ def check_bom(boms, all_prod):
12 res = True
13 for bom in boms:
14 if bom.product_id.id in all_prod:
15- res = res and False
16- all_prod.append(bom.product_id.id)
17+ return False
18 lines = bom.bom_lines
19 if lines:
20- res = res and check_bom([bom_id for bom_id in lines if bom_id not in boms])
21+ res = res and check_bom([bom_id for bom_id in lines if bom_id not in boms], all_prod + [bom.product_id.id])
22 return res
23- return check_bom(boms)
24+ return check_bom(boms, [])
25
26 _constraints = [
27 (_check_recursion, 'Error ! You cannot create recursive BoM.', ['parent_id']),

Subscribers

People subscribed via source and target branches

to all changes: