Here is review261811002 which simplify the synchronization but also support lot for internal shipment.
The major difference is that changing the product of a inventory move will affect the outgoing move either.
A second difference is that move without any inventory will be set to zero instead of being deleted.
With issue8253, we will have a link between the inventory moves and the outgoing moves. So I think the synchronization could be simplified and hardened by using the origin.
If we synchronize by origin then we could simplify the design for stock_lot.
So the algorithm could be:
- compute quantity per origin and a key (default: product and extended with lot) from the inventory moves
- update quantity of outgoing moves using origin of quantity:
- check if the key is valid for original move:
- if yes: update quantity if lower or create new move if higher
- if no: copy with default quantity and other key values
- update quantity to zero for missing origin
- create new move for unknown origins
This will also support to change the product (standard replacement) on inventory move and update it on the outgoing move.