[29.0] Bug 649448: Fully received WIP purchase orders block Disable Legacy Subcontracting - #12159
Chethan Thopaiah (ChethanT) wants to merge 4 commits into
Conversation
…block Disable Legacy Subcontracting (#12080) #### Summary Fix the Legacy Subcontracting disable prerequisite so fully received WIP purchase order lines no longer count as open. #### Validation - Added regression test `PreCheckDisableSucceedsWhenWIPPurchaseLineFullyReceived`. - Verified mandatory RED against the pre-fix Base Application. - Verified GREEN for the new regression and `PreCheckDisableRaisesErrorWhenOpenWIPPOsExist`. [AB#649448](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/649448)
Good Sense Reviewer - Round 1Recommendation: Request ChangesWhat this PR doesThis change lets fully received retained WIP purchase-order lines pass the disable prerequisite by checking document Outstanding Quantity. The nonzero filter still blocks positive and negative outstanding quantities and is used by both the pre-check and actual disable flow. The predicate fixes the immediate false block, but the retained line remains editable after the one-time migration. Increasing Quantity after disable can recreate nonzero legacy WIP when legacy validation is no longer active. Problem-solution fitFit: Partial The change fixes the reported zero-outstanding false block, but it does not preserve the completion rule after the feature is disabled. The retained line can become outstanding again without another migration. SuggestionsS1 (🔴 High): Prevent retained WIP lines from becoming outstanding again Risk assessment and necessityRisk: This BaseApp prerequisite controls a one-time migration. The transfer prerequisite uses the analogous nonzero-outstanding rule, but no guard prevents the retained purchase line from reopening legacy work after disable. No public API or event surface changes. Necessity: Ignoring zero-outstanding retained lines is required so completed orders do not block migration. The scope also needs a lifecycle guard so the same line cannot reopen legacy work after migration.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1d5f3a98-2e43-4044-a4fc-83e5d477ae8c
|
Addressed S1 in 8992573. A Purchase Line quantity-validation subscriber now rejects increasing a completed retained WIP order line when Legacy Subcontracting is disabled, while leaving ordinary purchase lines and legacy-enabled behavior unchanged. Added CannotReopenFullyReceivedWIPPurchaseLineAfterDisabling to cover the post-disable reopening path. |
Good Sense Reviewer - Round 2Recommendation: Request ChangesWhat this PR doesThe latest commit adds a Purchase Line quantity-validation subscriber and a regression test to stop a direct Quantity increase on a completed retained WIP line after Legacy Subcontracting is disabled. This closes the direct-edit path, but it does not close the full lifecycle issue. Undo Receipt reduces Quantity Received, recalculates Outstanding Quantity, and modifies the order line without validating Quantity, so the retained line can still become outstanding after the one-time transition. Status of previous suggestions
New observations (commits since round 1)None - the remaining blocker is the unresolved part of S1. Risk assessment and necessityRisk: This is a one-time migration boundary. Undo Receipt calls the standard purchase-line update path, subtracts received quantity, runs InitOutstanding, and modifies the retained line without reaching this new subscriber. That can recreate open legacy WIP after legacy handling is disabled. Necessity: Ignoring completed lines is required so they do not block migration. The lifecycle guard must also cover receipt undo, or the same retained line can become open again after the migration check can no longer protect it.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1d5f3a98-2e43-4044-a4fc-83e5d477ae8c
|
Follow-up lifecycle coverage added in 8a44501: receipt undo is now blocked when it would reopen a completed retained WIP purchase line after Legacy Subcontracting is disabled. The subscribers also moved into a dedicated non-obsolete guard, with focused receipt-undo regression coverage. |
Keep the compatibility guard available after legacy cleanup, use an allowed object ID, and move regression coverage to a non-obsolete test codeunit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1d5f3a98-2e43-4044-a4fc-83e5d477ae8c
Good Sense Reviewer - Round 3Recommendation: Request ChangesWhat this PR doesThe latest changes add a receipt-undo guard and move the lifecycle checks into a non-obsolete codeunit. Completed retained WIP purchase lines still pass the migration prerequisite based on document Outstanding Quantity. The receipt-undo subscriber runs before receipt checks and posting, closing the previously identified undo route after disabling. However, nested over-receipt validation can still restore outstanding legacy work. A second session can also undo a completed receipt during migration confirmation, before the migration locks are taken. Problem-solution fitFit: Partial The completion filter fixes the false migration block, and receipt undo after disabling is now protected. The retained line can still become outstanding through over-receipt validation or concurrent receipt undo during transition. Status of previous suggestions
S1 (🔴 High): Prevent retained WIP lines from becoming outstanding again New observations (commits since round 2)S3 (🔴 High): Recheck open WIP after taking migration locks S2 (🟠 Moderate): Cover permitted receipt undo and mixed selections Risk assessment and necessityRisk: A released retained WIP order with Quantity and Quantity Received both 10 can use an allowed over-receipt of 1 to validate Quantity as 11. The originating field is not Quantity, so the guard exits and Outstanding Quantity becomes 1. Receipt undo can also reopen the line while migration confirmation is open: the prerequisite is checked before confirmation, but is not repeated after locks are taken. Migration excludes WIP lines and its count verification does not detect the reopened line. The separate transfer prerequisite remains unchanged. Tests were inspected, not executed. Necessity: Completed retained orders must not block transition or require deletion. The receipt-undo protection after disabling is needed and correctly placed, but nested validation and concurrent changes during confirmation must also be covered to preserve that migration boundary.
|
Summary
Backport of #12080 to 29.0. Fix the Legacy Subcontracting disable prerequisite so fully received WIP purchase order lines no longer count as open.
Validation
releases/29.0.git diff --checkpassed.Fixes AB#649448