Nehal Panchal (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-573835-nep into 
lp:openobject-addons/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-573835-nep/+merge/107175

Hello,

Added constraint for restricting same product in BoM line of product.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-573835-nep/+merge/107175
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-573835-nep.
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py	2012-03-02 11:51:32 +0000
+++ mrp/mrp.py	2012-05-24 08:51:21 +0000
@@ -240,6 +240,7 @@
                 return False
             level -= 1
         return True
+<<<<<<< TREE
     
     def _check_product(self, cr, uid, ids, context=None):
         all_prod = []
@@ -256,6 +257,24 @@
             return res
         return check_bom(boms)
     
+=======
+    
+    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)    
+    
+>>>>>>> MERGE-SOURCE
     _constraints = [
         (_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

Reply via email to