[Bug Fix] #638531: Disable Open TO from PO actions on non-subcontracting lines#8752
Draft
ventselartur wants to merge 1 commit into
Draft
[Bug Fix] #638531: Disable Open TO from PO actions on non-subcontracting lines#8752ventselartur wants to merge 1 commit into
ventselartur wants to merge 1 commit into
Conversation
Bug #638531: [Subcontracting] Open TO from PO action only works from main item line
Root Cause:
- The "Transfer Order" and "Return Transfer Order" actions in pageextension
99001524 "Subc. PO Subform" call ShowTransferOrdersAndReturnOrder(Rec, ...),
which requires the current line's Prod. Order No. and silently exits when it is
empty. The actions were gated only at document level (Visible =
HasSubcontractingContext), so on a component/non-subcontracting line they stayed
enabled but did nothing.
Changes:
- Add OnAfterGetCurrRecord computing CurrentLineIsSubcontractingLine via
Subcontracting Management.IsSubcontractingPurchaseLine(Rec).
- Set Enabled = CurrentLineIsSubcontractingLine on action("Transfer Order") and
action("Return Transfer Order") so they are disabled on non-subcontracting lines.
Test Coverage:
- New test TransferOrderActionDisabledOnNonSubcontractingPurchaseLine in codeunit
139989 asserts the action is enabled on a subcontracting line and disabled on a
non-subcontracting line on the same order. Verified red without the fix
(deterministic across 3 runs) and green with the fix.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
ADO Work item #638531 - [Subcontracting] Open TO from PO action only works from main item line
Summary
The "Open TO from PO" actions on the subcontracting Purchase Order lines (Transfer Order / Return Transfer Order) are now disabled when the current line is not a subcontracting line, instead of appearing enabled but silently doing nothing.
Root Cause
The
Transfer OrderandReturn Transfer Orderactions in pageextension99001524 "Subc. PO Subform"callSubcPurchFactboxMgmt.ShowTransferOrdersAndReturnOrder(Rec, ...), which requires the current purchase line'sProd. Order No.andexit(0)s when it is empty. The enclosinggroup(Production)was gated only at the document level (Visible = HasSubcontractingContext), never per line. So on a component/non-subcontracting line the actions stayed enabled but did nothing - a usability/discoverability defect.Changes Made
src/Apps/W1/Subcontracting/App/src/Purchase/SubcPOSubform.PageExt.al: Added anOnAfterGetCurrRecordtrigger that computesCurrentLineIsSubcontractingLinefromSubcontracting Management.IsSubcontractingPurchaseLine(Rec), and setEnabled = CurrentLineIsSubcontractingLineonaction("Transfer Order")andaction("Return Transfer Order").src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingTest.Codeunit.al: Added regression testTransferOrderActionDisabledOnNonSubcontractingPurchaseLine.Implementation Process
al_build, scope=all)Test Evidence
Pre-Fix Test Results (Baseline)
Run without the fix (deterministic across 3 runs):
Post-Fix Test Results (Final)
Test Coverage
Review Notes
The fix relies on the existing internal
Subcontracting Management.IsSubcontractingPurchaseLine, which returns true only whenProd. Order No.andProd. Order Line No.are set.Generated by the bc-fix-bug skill