[FIX] purchase_stock_ux: don't cancel done downstream moves when dele…#333
Open
jcadhoc wants to merge 1 commit into
Open
[FIX] purchase_stock_ux: don't cancel done downstream moves when dele…#333jcadhoc wants to merge 1 commit into
jcadhoc wants to merge 1 commit into
Conversation
Contributor
9ffb421 to
d4eedf5
Compare
d4eedf5 to
abd47b8
Compare
…ting a PO line Standard purchase_stock PurchaseOrderLine.unlink() calls move_dest_ids._action_cancel() for propagate_cancel lines without filtering out moves already in 'done' state. When an MTO line's customer delivery was already shipped from on-hand stock, deleting the purchase line raised 'You cannot cancel a stock move that has been set to Done', blocking the edition of the RFQ. button_cancel() already guards against this (it filters state != 'done' before cancelling). Mirror that protection in unlink(): detach the already-done downstream moves before the standard unlink so they are no longer cancelled. The delivered move stays untouched. Adds a regression test reproducing the case.
abd47b8 to
4a4fab4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

…ting a PO line
Standard purchase_stock PurchaseOrderLine.unlink() calls move_dest_ids._action_cancel() for propagate_cancel lines without filtering out moves already in 'done' state. When an MTO line's customer delivery was already shipped from on-hand stock, deleting the purchase line raised 'You cannot cancel a stock move that has been set to Done', blocking the edition of the RFQ.
button_cancel() already guards against this (it filters state != 'done' before cancelling). Mirror that protection in unlink(): detach the already-done downstream moves before the standard unlink so they are no longer cancelled. The delivered move stays untouched.
Adds a regression test reproducing the case.