Skip to content
Snippets Groups Projects
Commit 7e96d485 authored by Arnold Moyaux's avatar Arnold Moyaux
Browse files

[FIX] stock: redundant move line on _set_quantity_done


Usecase to repdoduce:
BOM 1 final product F - 2 components C
- Create a MO of 2 units F
- Do not reserve
- Produce 1 units twice

You have 1 finished line with 0 quantity and another with 2 quantity.

It happens because _set_quantity_done expect reservation on
move line. It checks the reservation - quantity done on a move line
as quantity to add. Since you have no reservation in will result as
- quantity done and it will remove the quantity done on existing line.
Then it removes the quantity done added on move line on the total
quantity to add passed as an argument. It results as
qty_to_consume -(-move line quanity done). At the end of the method it
creates a new move line with the remaining quantity to consume (on which
was added the quantity done of not reserved move line).

Skip the move line update if the quantity reserved - quantity done is
negative.

closes odoo/odoo#31805

Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
parent 20c6a65c
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment