[FIX] stock_account: consider already processed qty in fifo
Steps to reproduce:
- Have a product valued in fifo
- Create 3 PO for it, each for 1 qty of price 10, 20 and 30.
- Confirm these PO & validate their receipts
- Create 2 SO for this product, each for 1 qty
- Confirm these SO & validate their deliveries together
Issue: The value associated to the delivery moves (and so the cogs generated from them) is 10 for both.
When calling _action_done() on the moves, we'll set the value of each move before moving them.
To get the correct value from the fifo stack, we rely on the qty_available at the time. However, since we're going to set the value of multiple moves before validating them, the qty_available won't be updated between each call.
opw-5359484
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#238680
@clesgow @amoyaux this PR targets master and is the last of the forward-port chain.
To merge the full chain, use
@robodoo r+
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
@clesgow @amoyaux this forward port of odoo/odoo#238680 is awaiting action (not merged or closed).
@clesgow @amoyaux this forward port of odoo/odoo#238680 is awaiting action (not merged or closed).
