[FIX] Mark stock move as auto_validate so that purchase procurement will complete.
authorDon Kirkby <donkirkby+launpd@gmail.com>
Thu, 6 Jan 2011 23:23:31 +0000 (15:23 -0800)
committerDon Kirkby <donkirkby+launpd@gmail.com>
Thu, 6 Jan 2011 23:23:31 +0000 (15:23 -0800)
lp bug: https://launchpad.net/bugs/532148 fixed

bzr revid: donkirkby+launpd@gmail.com-20110106232331-te94j93k3i8uj95m

addons/purchase/purchase.py

index 7883da5..ce8f80a 100644 (file)
@@ -424,7 +424,18 @@ class purchase_order(osv.osv):
                         'purchase_line_id': order_line.id,
                     })
                     if order_line.move_dest_id:
-                        self.pool.get('stock.move').write(cr, uid, [order_line.move_dest_id.id], {'location_id':order.location_id.id})
+                        # make the procurement's stock move into a dummy move
+                        # (source == destination) and mark it as auto validate
+                        # so that the procurement will complete when the
+                        # purchase shipment arrives. 
+                        self.pool.get('stock.move').write(
+                            cr, 
+                            uid, 
+                            [order_line.move_dest_id.id], 
+                            {
+                                'location_id': order.location_id.id, 
+                                'auto_validate': True
+                            })
                     todo_moves.append(move)    
             self.pool.get('stock.move').action_confirm(cr, uid, todo_moves)
             self.pool.get('stock.move').force_assign(cr, uid, todo_moves)