Amit Dodiya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw-516475-ado into
lp:openobject-addons/6.0.
Requested reviews:
Jean-Christophe VASSORT (OpenERP) (jcv-openerp)
nel (nel-tinyerp)
Xavier ALT (OpenERP) (xal-openerp)
Naresh(OpenERP) (nch-openerp)
Related bugs:
Bug #733156 in OpenERP Addons: "Cannot post consume on production order"
https://bugs.launchpad.net/openobject-addons/+bug/733156
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-516475-ado/+merge/95546
Hello,
[FIX] When creating BOM it should not allow you to add the same product again
in components.
Code is back-ported from trunk.
Thanks,
Amit
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-516475-ado/+merge/95546
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw-516475-ado.
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py 2011-11-25 13:23:07 +0000
+++ mrp/mrp.py 2012-03-02 12:17:21 +0000
@@ -240,8 +240,25 @@
return False
level -= 1
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):
+ 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)
+ lines = bom.bom_lines
+ if lines:
+ res = res and check_bom([bom_id for bom_id in lines if bom_id not in boms])
+ return res
+ return check_bom(boms)
+
_constraints = [
- (_check_recursion, 'Error ! You can not create recursive BoM.', ['parent_id'])
+ (_check_recursion, 'Error ! You can not create recursive BoM.', ['parent_id']),
+ (_check_product, 'BoM line product should not be same as BoM product.', ['product_id'])
]
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp