Skip to content

[Master]-]Withholding Tax Entries are not generated at payment because the Withholding Tax. Prod. Posting Group field gets not transferred to the payment line#9375

Open
neeleshsinghal wants to merge 6 commits into
mainfrom
bugs/Bug-639524-WHT-Prod-Posting-Group-not-transferred-to-payment
Open

[Master]-]Withholding Tax Entries are not generated at payment because the Withholding Tax. Prod. Posting Group field gets not transferred to the payment line#9375
neeleshsinghal wants to merge 6 commits into
mainfrom
bugs/Bug-639524-WHT-Prod-Posting-Group-not-transferred-to-payment

Conversation

@neeleshsinghal

@neeleshsinghal neeleshsinghal commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

AB#639524

Squashed replacement of #9323 (single commit).

@neeleshsinghal neeleshsinghal requested a review from a team July 14, 2026 04:44
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jul 14, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 8 · 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
Performance 1 1 0 1 0

Totals: 1 knowledge-backed · 0 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.

GenJournalLine2.SetRange("Journal Batch Name", GenJournalBatch.Name);
GenJournalLine2.SetRange("Document No.", StartingDocumentNo);
GenJournalLine2.FindFirst();
GenJournalLine2.TestField("Wthldg. Tax Prod. Post. Group", WHTProdPostingGroup.Code);

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

The new test WHTProdPostGroupTravelsFromInvoiceToJournalLineOnApplication enqueues four values into LibraryVariableStorage (template name, batch name, starting document no., bank account) consumed by CreatePaymentPageHandler, but never calls LibraryVariableStorage.AssertEmpty before the test ends.

Per BCQuality guidance, ending a test without AssertEmpty hides a leaked queue or a handler that dequeued fewer/more values than expected, so a future regression in the handler wiring could pass silently. Add LibraryVariableStorage.AssertEmpty() at the end of the test body.

Knowledge:

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

v-ankitgoyal
v-ankitgoyal previously approved these changes Jul 15, 2026
end;


[EventSubscriber(ObjectType::Page, Page::"Create Payment", OnBeforeUpdateGnlJnlLineDimensionsFromVendorPayment, '', false, 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\ —\ Agent} \quad \color{gray}{\texttt{\small Iteration\ 4}}$

AssignWHTPostingGroupOnCreatePayment only subscribes to Page "Create Payment"'s OnBeforeUpdateGnlJnlLineDimensionsFromVendorPayment event, so the Wthldg.

Tax Prod. Post. Group is copied to the payment line only when a payment is created via the Vendor Ledger Entries "Create Payment" action. The very similar OnBeforeUpdateGnlJnlLineDimensionsFromVendorPaymentBuffer event, raised by the Suggest Vendor Payments report/batch job in every localization layer (W1, NA, IT, RU, CH, ES, APAC, FI), has no corresponding subscriber added in this PR. Payment lines generated by Suggest Vendor Payments will therefore still have a blank Wthldg. Tax Prod. Post. Group, leaving the exact bug this PR fixes unresolved for that entry point.

Recommendation:

  • add an equivalent subscriber (or shared helper) for OnBeforeUpdateGnlJnlLineDimensionsFromVendorPaymentBuffer so both payment-creation paths populate the field consistently.

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

if CheckWithholdingTaxDisabled() then
exit;

if GenJournalLine."Applies-to ID" = '' then

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

The guard if GenJournalLine."Applies-to ID" = '' then exit; can never be true for this event: the only publisher, CopyTempPaymentBufferToGenJournalLines in CreatePayment.Page.al, unconditionally sets GenJnlLine."Applies-to ID" := GenJnlLine."Document No." (always a non-blank generated value) before raising OnBeforeUpdateGnlJnlLineDimensionsFromVendorPayment.

The guard is dead code that misleadingly suggests the subscriber skips unapplied payments via this check, while the real filtering is done by the following TempVendorPaymentBuffer."Vendor Ledg. Entry No." = 0 guard.

Recommendation:

  • remove the ineffective check or replace it with a check that reflects the real intent (for example, TempVendorPaymentBuffer."Vendor Ledg. Entry Doc. No." = '') if the goal is to skip payments not applied to a specific document.

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

Comment thread src/Apps/W1/WithholdingTax/Test/src/ERMWithholdingTaxTestsII.Codeunit.al Outdated
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants