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

[FIX] stock: MTO overprocessed move


Error due to other module (e.g. purchase_stock, mrp) that will
define their own rules in order to merge or not moves together.
Usecase:
- Install purchase_stock
- Create a product MTO + buy with a vendor
- Create a SO of 1 unit
- On the PO receive 2 units
- On the delivery deliver 2 units

It will create an empty delivery and put the entire move in
a back order.

First issue the extra move is created as a MTO if it's copied from an
MTO move. So il will trigger all the pull rule. We won't it because it's
an extra quantity and the rules should be only trigger by the original
document (SO/MO).
Also an extra move in a picking do the hypothesis that the original move and
the extra move will always be merged together. But in the previous
usecase, the module purchase add the condition that 'created_purchase_line_id'
and 'purchase_line_id' should be the same in order to merge move.
'created_purchase_line_id' is also copy=False, so the move and the
extra move will not be merged. create_extra_move only returns the extra
move and _action_done only process the moves returned by _create_extra_move.
It result by an original move not merged and not processed by _action_done,
it will be automaticaly set in a back order and the extra move is
processed.

In order to fix it, check if the move and the original move will be
merged. If not, returns both moves.

opw-2008113
Close #34005

closes odoo/odoo#34411

Signed-off-by: default avatarSimon Lejeune (sle) <sle@openerp.com>
parent 5b80695f
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