Skip to content
Snippets Groups Projects
Commit 856ac41a authored by Pratima Gupta's avatar Pratima Gupta Committed by Arnold Moyaux
Browse files

[FIX] stock: do not recompute draft, done, cancel moves


Backport of commit 9ba3fc4c8767498890f7b5c4126f3bf2017efc97

Usecase to reproduce:
- Set a product with routes: MTO + Buy
- Create and valide a SO
- Cancel the delivery
- Cancel the RFQ linked

-> The delivery will be switch to confirmed state while it should remain
cancel.

It happens because the button_cancel on purchase.order call
_recompute_state on move. _recompute_state modify the state to confirm,
partially_available or available depending the reservation status.
Howver it should never be call on 'draft', 'cancel' or 'done' moves
since it would modify their state.

A fix would be to filter the set of moves in order to exclude moves that
are cancel, done or draft before using _recompute_state. However this is
easy to forget and the issue would be probably redo in the future.

A more stable fix is to add the filter in the _recompute_state directly.

closes odoo/odoo#42484

Task: 2157543
Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
parent 1dcd03d1
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