What is stock_move's move_dest_id field? What relation does it have to pickings and stock move assignment?


This is my current understanding of OpenERP's stock system, please correct me or confirm my understanding.

Stock moves in OpenERP represent a move of products from one stock.location to another. A stock.location represents a physical place or a virtual concept for products that are incoming or outgoing.

When a product is needed in a stock.location, a procurement.order is created to fulfill the requirement. This procurement.order has a stock.move move_id attached to it, assigned / created when the procurement.order transitions from the draft to the confirmed state.

The procurement.order's state tracks the progress of obtaining a stock move, and will only transition to the ready or complete state when the stock move's state is set to assigned or done. This is checked for make_to_stock procurements whenever the procurement moves past the confirmed state, and depending on the stock move's state, the procurement can then move to ready, complete, or exception. This is checked formake_to_order` procurements when the procurement's subflow (buy or produce) is completed.

When a stock.move is completed by any means (state changes to done via action_done()), it moves from the waiting or confirmed state to the assigned state. At this point, if the move_dest_id field is not empty, the code checks to see if all other moves with the same move_dest_id field are done. If so, the destination move is marked complete as well (recursively).

So I have a few questions:

  1. What is the point of move_dest_id? Is it more or less a way to skip having manual make_to_stock procurements all over the place when a chain of moves is desired?

  2. What exactly is this move chain for? I seem to be able to follow it from a sales order move line, into a procurement, through a MO, past the finished product, through each of the component products, though their procurements, through more MOs, etc. Can this be used to display the full path / full chain of products that are needed to ship a sales order line?

1 Answer
Vince Vinet
Best Answer

The move_dest_id, and the move chain, are used to track when a move depends on another move being made before it. In the case of procurements and ordering rules generating MOs for parts, MOs for complete products, all the way to a delivery order, it can indeed let you "see" the full chain of moves that you need to complete in order to complete the sale order.

Moves set up in this fashion will often end up in the "waiting" (Waiting Another Move) state, indicating that you need to complete other moves before being able to process this one.