[Bug Fix] #638531: Disable Open TO from PO actions on non-subcontracting lines - #8752
[Bug Fix] #638531: Disable Open TO from PO actions on non-subcontracting lines#8752ventselartur wants to merge 7 commits 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>
…638531-SubcontractingOpenPOFromTO
…ord trigger in Subc. PO Subform Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…638531-SubcontractingOpenPOFromTO
…638531-SubcontractingOpenPOFromTO
Agentic PR Review - Round 1Recommendation: Accept with SuggestionsWhat this PR doesThe fix disables the "Transfer Order" and "Return Transfer Order" actions on the subcontracting Purchase Order subform when the current line is not a subcontracting line. Before the fix these actions stayed enabled on component or other non-subcontracting lines but did nothing, because The change is correct and targets the root cause. A new global SuggestionsS1 - Same silent no-op on the Production Order actions S2 - Test does not cover the Return Transfer Order action Risk assessment and necessityRisk: Low. The change is limited to the enabled state of two actions on one page extension ( Necessity: Justified. The linked Bug 638531 (Severity 3, Priority 2) describes a real usability and discoverability defect: users on component lines see an enabled action that does nothing. The scope is right for a bug fix - two small property additions plus one trigger line, with a regression test that verifies both the enabled and disabled states. Without the change users stay confused by an action that appears usable but is not.
|
|
Pull request was closed
fa620e2
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.Fixes: AB#638531