Skip to content

[FIX] purchase_stock_ux: don't cancel done downstream moves when dele…#333

Open
jcadhoc wants to merge 1 commit into
ingadhoc:18.0from
adhoc-dev:18.0-h-118671-jc
Open

[FIX] purchase_stock_ux: don't cancel done downstream moves when dele…#333
jcadhoc wants to merge 1 commit into
ingadhoc:18.0from
adhoc-dev:18.0-h-118671-jc

Conversation

@jcadhoc

@jcadhoc jcadhoc commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

…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.

@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

@jcadhoc jcadhoc force-pushed the 18.0-h-118671-jc branch 2 times, most recently from 9ffb421 to d4eedf5 Compare June 9, 2026 18:24
…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.
@jcadhoc jcadhoc force-pushed the 18.0-h-118671-jc branch from abd47b8 to 4a4fab4 Compare June 12, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants