Skip to content

[Subcontracting] Subcontracting actions on Purchase Order and Transfer Order lines are always visible #8510

Open
AleksandricMarko wants to merge 1 commit into
mainfrom
bugs/main_637633_subcontracting_action_show_hide
Open

[Subcontracting] Subcontracting actions on Purchase Order and Transfer Order lines are always visible #8510
AleksandricMarko wants to merge 1 commit into
mainfrom
bugs/main_637633_subcontracting_action_show_hide

Conversation

@AleksandricMarko
Copy link
Copy Markdown
Contributor

@AleksandricMarko AleksandricMarko commented Jun 5, 2026

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

@AleksandricMarko AleksandricMarko requested a review from a team as a code owner June 5, 2026 19:00
@AleksandricMarko AleksandricMarko added the Subcontracting Subcontracting related activities label Jun 5, 2026
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jun 5, 2026
@AleksandricMarko AleksandricMarko enabled auto-merge (squash) June 5, 2026 19:01
@github-actions github-actions Bot added this to the Version 29.0 milestone Jun 5, 2026
exit(not PurchaseLine.IsEmpty());
end;

internal procedure IsSubcontractingPurchaseLine(PurchaseLine: Record "Purchase Line"): Boolean
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Upgrade} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

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.
Suggested change
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");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Upgrade} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

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.
Suggested change
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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Upgrade} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

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.
Suggested change
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Subcontracting Subcontracting related activities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants