[Subcontracting] Subcontracting actions on Purchase Order and Transfer Order lines are always visible #8510
Conversation
| exit(not PurchaseLine.IsEmpty()); | ||
| end; | ||
|
|
||
| internal procedure IsSubcontractingPurchaseLine(PurchaseLine: Record "Purchase Line"): Boolean |
There was a problem hiding this comment.
IsSubcontractingPurchaseLine and TransferLine are dead code
Two new internal procedures (IsSubcontractingPurchaseLine and IsSubcontractingTransferLine) were added in this PR but are never called from any file in the codebase. Dead internal methods increase maintenance surface without providing any immediate value.
Recommendation:
- Remove IsSubcontractingPurchaseLine and IsSubcontractingTransferLine if they are not used, or add usages where they were intended to be called. If they are planned for future use, add a comment linking to the follow-up issue.
| internal procedure IsSubcontractingPurchaseLine(PurchaseLine: Record "Purchase Line"): Boolean | |
| // Remove or defer: | |
| // internal procedure IsSubcontractingPurchaseLine(...) | |
| // internal procedure IsSubcontractingTransferLine(...) |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| var | ||
| PurchaseLine: Record "Purchase Line"; | ||
| begin | ||
| PurchaseLine.SetRange("Document Type", Rec."Document Type"); |
There was a problem hiding this comment.
Subcontracting detection logic changed silently
The old SubcontractingInLines() filtered purchase lines on Work Center No. <> '', while the new IsSubcontractingPurchaseDocument checks Prod. Order No. <> '' AND Prod. Order Line No. <> 0. Purchase orders that have subcontracting lines with a work center assigned but no production order link would previously show subcontracting UI but will now hide it, potentially confusing users with partially-configured orders.
Recommendation:
- Verify that the new condition is intentionally more restrictive. If the intent is to show subcontracting UI only for fully linked production orders, document this behavioral change. Otherwise align the filter with the original intent.
| PurchaseLine.SetRange("Document Type", Rec."Document Type"); | |
| // Confirm this is the intended behavior; if not, restore: | |
| PurchaseLine.SetFilter("Work Center No.", '<>%1', ''); | |
| exit(not PurchaseLine.IsEmpty()); |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
| { | ||
| Caption = 'Transfer WIP Item'; | ||
| DataClassification = CustomerContent; | ||
| Editable = false; |
There was a problem hiding this comment.
Non-editable field retains OnValidate trigger
The Transfer WIP Item field is now marked Editable = false, which prevents user input, yet the OnValidate trigger (line ~106) remains. While the trigger may still be reachable programmatically via Validate(), having a validate trigger on a non-editable field is misleading to maintainers and may indicate the Editable constraint should be conditional or the trigger should be reviewed.
Recommendation:
- Confirm whether the OnValidate trigger is still needed for programmatic Validate() calls. If so, add a comment explaining why. If the field is purely system-managed, consider whether the validate logic should move to a dedicated procedure.
| Editable = false; | |
| // If Editable = false is intentional, document why OnValidate is retained: | |
| // Note: Editable = false prevents direct user editing; OnValidate is called only via programmatic Validate(). |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
What & why
Expected
All subcontracting actions should be hidden when there is no subcontracting context, using the same ShowSubcontractingFactBox variable already computed in each page extension.
Fix
Add Visible = ShowSubcontractingFactBox; to each action (or action group) in the three page extensions: SubcPurchOrder.PageExt.al, SubcPOSubform.PageExt.al, SubcTransOrderSub.PageExt.al. The variable and its computation already exist in each file.
Linked work
Fixes AB#637633