Riken Bhorania (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-bug-740047-rch into 
lp:openobject-addons/6.0.

Requested reviews:
  Jay Vora (OpenERP) (jvo-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-740047-rch/+merge/65310

Hello Sir,

When 'Raw Materials Location' and 'Source Location' of 'Products to Consume' in 
the MO is same then stock move(s) from 'Raw Materials Location' to 'Source 
Location' should not be generated.

Also no need to create Procurement(s) regarding this kind of stock move(s).

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-740047-rch/+merge/65310
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-bug-740047-rch.
=== modified file 'mrp/mrp.py'
--- mrp/mrp.py	2011-04-04 11:25:26 +0000
+++ mrp/mrp.py	2011-06-21 07:31:34 +0000
@@ -888,21 +888,25 @@
                         'company_id': production.company_id.id,
                     })
                     moves.append(res_dest_id)
-                    move_id = move_obj.create(cr, uid, {
-                        'name':'PROD:' + production.name,
-                        'picking_id':picking_id,
-                        'product_id': line.product_id.id,
-                        'product_qty': line.product_qty,
-                        'product_uom': line.product_uom.id,
-                        'product_uos_qty': line.product_uos and line.product_uos_qty or False,
-                        'product_uos': line.product_uos and line.product_uos.id or False,
-                        'date': newdate,
-                        'move_dest_id': res_dest_id,
-                        'location_id': production.location_src_id.id,
-                        'location_dest_id': routing_loc or production.location_src_id.id,
-                        'state': 'waiting',
-                        'company_id': production.company_id.id,
-                    })
+                    previous_move_obj = move_obj.browse(cr, uid, res_dest_id)
+                    if production.location_src_id.id != previous_move_obj.location_id.id:
+                        move_id = move_obj.create(cr, uid, {
+                            'name':'PROD:' + production.name,
+                            'picking_id':picking_id,
+                            'product_id': line.product_id.id,
+                            'product_qty': line.product_qty,
+                            'product_uom': line.product_uom.id,
+                            'product_uos_qty': line.product_uos and line.product_uos_qty or False,
+                            'product_uos': line.product_uos and line.product_uos.id or False,
+                            'date': newdate,
+                            'move_dest_id': res_dest_id,
+                            'location_id': production.location_src_id.id,
+                            'location_dest_id': routing_loc or production.location_src_id.id,
+                            'state': 'waiting',
+                            'company_id': production.company_id.id,
+                        })
+                    else:
+                        continue;
                 proc_id = proc_obj.create(cr, uid, {
                     'name': (production.origin or '').split(':')[0] + ':' + production.name,
                     'origin': (production.origin or '').split(':')[0] + ':' + production.name,

_______________________________________________
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