Improve _sync_inventory_to_outgoing
With #8253 (closed), 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.