[Bug Fix] #638815: Subcontracting: actionable error for blank Subc. Location Code on WIP transfers#8754
Draft
ventselartur wants to merge 1 commit into
Draft
Conversation
… Code for WIP transfers at any stage
Contributor
|
Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234' |
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.
Bug Reference
Azure DevOps work item #638815 — Subcontracting: No validation of blank Subc. Location Code for WIP transfers at any stage
Summary
When "Transfer WIP Item" is enabled on a subcontracting routing line but the subcontractor has no Subc. Location Code, the user could complete the entire flow (refresh prod. order, create subcontracting PO) and only hit a generic, unactionable error — "Nothing to create. No components or WIP to transfer for the specified subcontracting order." — when clicking Create Transf. Ord. to Subcontractor. This change raises a clear, actionable
TestFielderror on the vendor's Subc. Location Code, mirroring how the components path already validates it.Root Cause
In
report 99001501 "Subc. Create Transf. Order", procedureCheckCreateWIPTransferresolves the transfer-to location from the Purchase Header / Vendor Subc. Location Code. At that point it has already established that there is WIP to transfer (ExpectedQtyBase > 0). When the resolved location was blank, the procedure silently didexit(false), which propagated up throughHandleWIPTransferForPurchLine→CheckTransferCreatedand surfaced only the genericNothingToCreateErr. The components path, by contrast, callsVendor.TestField("Subc. Location Code")inGetTransferToLocationCode, giving an early actionable error.Changes Made
src/Apps/W1/Subcontracting/App/src/Transfer/SubcCreateTransfOrder.Report.al: inCheckCreateWIPTransfer, replace the silentexit(false)for a blank transfer-to location withVendorFromPurchOrder.TestField("Subc. Location Code"), surfacing an actionable misconfiguration error consistent with the components path.src/Apps/W1/Subcontracting/Test/Tests/SubcWIPTransCreateTest.Codeunit.al: add regression testWIPTransferCreationFailsWithTestFieldErrorWhenSubcLocationBlank(codeunit 149911) that clears both the Vendor and Purchase Header Subc. Location Code on a WIP-transfer-enabled flow and asserts theTestFielderror instead of the generic message.Implementation Process
al_buildscope=all, green)Test Evidence
Pre-Fix Test Results (Baseline)
Post-Fix Test Results (Final)
Total Tests Run: 19 (codeunit 149911)
All Tests Passing: ✅ Yes
Test Coverage
Review Notes
The fix is a single-line change in
CheckCreateWIPTransfer. BecauseTestFieldalways errors on a blank value, control never falls through, so no explicitexitis required after it. The behavior now matches the existing components-path validation inGetTransferToLocationCode.🤖 Generated by the bc-fix-bug skill