Skip to content

Extract NL customization to object extensions (TrMode)#8933

Open
Alexander-Ya wants to merge 23 commits into
mainfrom
bugs/Extract-NL-customization-to-object-extensions-v2
Open

Extract NL customization to object extensions (TrMode)#8933
Alexander-Ya wants to merge 23 commits into
mainfrom
bugs/Extract-NL-customization-to-object-extensions-v2

Conversation

@Alexander-Ya

@Alexander-Ya Alexander-Ya commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What & why

Linked work

Fixes AB#640601

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)

Risk & compatibility

@Alexander-Ya
Alexander-Ya requested review from a team June 30, 2026 13:39
@Alexander-Ya

Copy link
Copy Markdown
Contributor Author

Fixes AB#640601

Comment thread src/Layers/NL/BaseApp/Local/Purchases/Vendor/VendorNL.TableExt.al
Comment thread src/Layers/NL/BaseApp/Local/Purchases/Vendor/VendorNL.TableExt.al
Comment thread src/Layers/NL/BaseApp/Local/Sales/Customer/CustomerNL.TableExt.al
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 16 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@186d8a131465475c79244d994acb872cd5c0d4bf

Findings by domain

Findings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).

Domain Findings Knowledge-backed Agent Inline Fallback
Style 3 2 1 3 0
Testing 1 0 1 0 0

Totals: 2 knowledge-backed · 2 agent findings.

Orchestrator pre-filter (2 file(s) excluded)

  • layer-disabled (knowledge) : 2 file(s)

Findings produced by the AL review agent v1.7.3. Reply 👎 on any inline comment to flag false positives.

JesperSchulz pushed a commit that referenced this pull request Jun 30, 2026
The model-reported anchor for a single-line suggestion can be off by more
than 8 lines (e.g. PR #8933 VendorNL Confirm() was off by 10, label rename
off by 9). Widen the search window to 40 lines either side so the correct
target within the same procedure is considered, while the 0.5 similarity
floor and 0.1 ambiguity margin keep an unrelated look-alike from winning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JesperSchulz pushed a commit that referenced this pull request Jun 30, 2026
Widening the search window exposed a precision problem: a label-rename
suggestion whose added Comment text echoes the field captions at the
Error()/Confirm() call site would re-anchor onto the call site (PR #8933
GenJournalLineNL/GeneralLedgerSetupNL 'Text1000000/1' findings), which is
worse than the original mis-anchor.

Raise the similarity floor to 0.6 and use a bounded window (20). Genuine
edit targets - an edited statement or a renamed declaration - score
~0.75-0.99 and re-anchor confidently (the PR #8933 Confirm() findings and
the PartnerTypeMismatchMsg->Qst rename now land on the right line). Lower-
confidence look-alikes stay below the floor and are suppressed, so the
caller posts a manual snippet instead of a wrong auto-applicable anchor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment was marked as resolved.

Comment thread src/Layers/NL/BaseApp/Local/Sales/Customer/CustomerNL.TableExt.al
Comment thread src/Layers/NL/BaseApp/Local/Sales/Customer/CustomerNL.TableExt.al
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 1, 2026
Comment thread src/Layers/NL/BaseApp/Local/Permissions/localnl.permissionsetext.al
Comment thread src/Layers/NL/BaseApp/Local/Purchases/Payables/VendorLedgerEntryNL.TableExt.al Outdated
Comment thread src/Layers/NL/BaseApp/Local/Sales/Receivables/CustLedgerEntryNL.TableExt.al Outdated
Comment thread src/Layers/W1/Tests/SCM-Service/ServiceOrderRelease.Codeunit.al
…Extract-NL-customization-to-object-extensions-v2
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 5

Recommendation: Request Changes

What this PR does

This PR extracts NL BaseApp Transaction Mode customization into extension objects for AB#640601. Since round 4, the author-owned AL changes are test-only: one commit fixes setup in an NL purchase document amount test, and one commit disables a W1 service-order warehouse shipment test.

The NL test setup change looks like a real test fix: it enables Check Doc. Total Amounts and fills the document amount fields before posting. It does not weaken Transaction Mode coverage, but it also does not address the open Transaction Mode scoping issue. The disabled W1 test is not justified and removes active coverage.

Status of previous suggestions
ID Title Status Author response / evidence
S1 Keep the G/L Account field id stable Addressed Still addressed. G/L Account.Omit Default Descr. in Jnl. remains field 11400 in src/Layers/NL/BaseApp/Finance/GeneralLedger/Account/GLAccount.Table.al.
S2 Update the matching role center tooltip Addressed Still addressed for the copies where the caption was expanded to General Business Posting Groups.
S3 Add coverage for Transaction Mode wiring Not addressed The only NL test change is in ERMPurchaseDocAmounts.Codeunit.al, which covers purchase document amount setup/correction, not Transaction Mode copying or NL-company scoping.
S4 Keep abbreviated tooltip text where the caption is abbreviated Not addressed APAC, AU, IT, NA, NL, NO, and RU still show caption Gen. Business Posting Groups with tooltip Open the General Business Posting Groups page.
S5 Scope all Transaction Mode effects Not addressed No author reply was found after round 4, and the new commits do not touch the unguarded Transaction Mode subscribers in SalesHeaderNL.Codeunit.al, PurchaseHeaderNL.Codeunit.al, CustomerNL.Codeunit.al, or GenJournalLineNL.Codeunit.al.
New observations (commits since round 4)

S6 - Do not disable unrelated W1 tests
Skip one test comments out [Test] on PullServiceLineNoShipmentUsingUseFilter in src/Layers/W1/Tests/SCM-Service/ServiceOrderRelease.Codeunit.al. This removes a warehouse shipment regression test instead of fixing it. Re-enable it, or replace it with an active equivalent test.

Risk assessment and necessity

Risk: The main product risk is still that non-NL companies can receive NL Transaction Mode behavior through unguarded subscribers that copy or enforce Transaction Mode outside the guarded field OnValidate triggers. The new skipped W1 service-order test adds a separate test-quality risk because it reduces coverage for warehouse shipment filtering in a shared W1 area.

Necessity: The extraction remains necessary for AB#640601 because it removes NL full-object customization and lowers future merge cost. The round-5 test changes are not enough to make the PR safe: the Transaction Mode scope must cover all paths, and unrelated tests should not be disabled to get the branch green.


[AI-PR-REVIEW] version=1 system=github pr=8933 round=5 by=alexei-dobriansky at=2026-07-15T17:03:19Z lastSha=7d59f77109426874a158f3c53db67f16c2f3a498 suggestions=S1:addressed,S2:addressed,S3:notaddressed,S4:notaddressed,S5:notaddressed,S6:new parentRound=4

Comment thread src/Layers/NL/BaseApp/Local/Foundation/Company/CompanyInformationNL.TableExt.al Outdated
Comment thread src/Layers/W1/Tests/SCM-Service/ServiceOrderRelease.Codeunit.al
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Testing} \quad \color{gray}{\texttt{\small Iteration\ 15}}$

The [Test] attribute on procedure PullServiceLineNoShipmentUsingUseFilter was commented out (changed to '// [Test]'), which silently removes this test case from the test run instead of deleting it or marking it Obsolete with a documented reason.

The test body, assertions, and helper calls remain fully intact, indicating this was very likely a leftover debugging change rather than an intentional removal. If genuinely intentional, impact would be major (a real regression test for warehouse-shipment source filtering with no matching orders would stop running in CI without any record of why); capped to minor per agent-finding severity rules. Recommend restoring the [Test] attribute, or if the test is no longer valid, deleting it or using [Test, Disabled] equivalent tracked in an issue with a comment explaining the reason.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

    [Test]

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

Access = Internal;

[EventSubscriber(ObjectType::Page, Page::"Purch. Invoice Subform", 'OnAfterNoOnAfterValidate', '', false, false)]
local procedure OnAfterNoOnAfterValidate(var PurchaseLine: Record "Purchase Line"; xPurchaseLine: Record "Purchase Line")

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{🔴\ Critical\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 16}}$

The new EventSubscriber OnAfterNoOnAfterValidate on Page::"Purch.

Invoice Subform" declares its second parameter as xPurchaseLine: Record "Purchase Line" (no var), but the publisher (PurchInvoiceSubform.Page.al line 1593) declares it as var xPurchaseLine: Record "Purchase Line". AL requires a subscriber to reproduce the publisher's parameter list, including var/byref modifiers, verbatim. This var mismatch will fail to compile/bind. Compare with the sibling PurchCrMemoSubformNL.Codeunit.al, which correctly copies both var modifiers from its own publisher.

Suggested change
local procedure OnAfterNoOnAfterValidate(var PurchaseLine: Record "Purchase Line"; xPurchaseLine: Record "Purchase Line")
local procedure OnAfterNoOnAfterValidate(var PurchaseLine: Record "Purchase Line"; var xPurchaseLine: Record "Purchase Line")

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

Access = Internal;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post Prepayments", 'OnBeforePostCustomerEntry', '', false, false)]
local procedure OnBeforePostCustomerEntry(var GenJnlLine: Record "Gen. Journal Line"; SalesHeader: Record "Sales Header")

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{🔴\ Critical\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 16}}$

The new EventSubscriber OnBeforePostCustomerEntry on Codeunit::"Sales-Post Prepayments" is declared with only two parameters, `(var GenJnlLine: Record "Gen.

Journal Line"; SalesHeader: Record "Sales Header"), but the publisher (SalesPostPrepayments.Codeunit.al line 2431) declares six parameters: (var GenJnlLine: Record "Gen. Journal Line"; TotalPrepmtInvLineBuffer: Record "Prepayment Inv. Line Buffer"; TotalPrepmtInvLineBufferLCY: Record "Prepayment Inv. Line Buffer"; CommitIsSuppressed: Boolean; SalesHeader: Record "Sales Header"; DocumentType: Option Invoice,"Credit Memo")`. A subscriber cannot cherry-pick a subset of the publisher's parameters; the full parameter list, in order, must be reproduced. As written this subscriber will not bind to the publisher and the extracted NL Transaction Mode Code/Bank Account Code logic that used to run inline in the old NL override of Sales-Post Prepayments will silently stop firing.

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

@@ -7581,7 +7582,7 @@ table 36 "Sales Header"
if ReplaceVATDate then
"VAT Reporting Date" := VATDateReq;

if ReplaceDocDate and ("Document Date" <> PostingDateReq) then begin
if ReplacePostingDate and ReplaceDocDate and ("Document Date" <> PostingDateReq) then begin

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\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 16}}$

SalesHeader.Table.al's BatchConfirmUpdatePostingDate procedure was changed to if ReplacePostingDate and ReplaceDocDate and (...), but the procedure already exits immediately at its top with if not ReplacePostingDate then exit;.

By the time execution reaches this line, ReplacePostingDate is always true, so the added conjunct is dead/redundant code. The same change is duplicated identically across every per-country-layer copy of SalesHeader.Table.al touched by this PR (W1, NO, and others), suggesting an unrelated, mechanically-applied edit rather than an intentional fix. Recommend removing the redundant ReplacePostingDate and or clarifying the actual intent if this guard is meant to protect against a future refactor of the early exit.

Suggested change
if ReplacePostingDate and ReplaceDocDate and ("Document Date" <> PostingDateReq) then begin
if ReplaceDocDate and ("Document Date" <> PostingDateReq) then begin

Agent judgement — not directly backed by a BCQuality knowledge article.

👍 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

Delocalization Extracting from country layers and converting local functionality to app Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants