Skip to content

[Master]-Non-Deductible Reverse-Charge VAT Correction Is Posted to Purchase VAT Account Instead of Payment Discount Account. - #12474

Open
Fixes4BC (neeleshsinghal) wants to merge 4 commits into
mainfrom
bugs/Bug-649383-NonDed-ReverseVAT-Posted-to-Payment-Dis-Account
Open

Fixes4BC (neeleshsinghal) wants to merge 4 commits into
mainfrom
bugs/Bug-649383-NonDed-ReverseVAT-Posted-to-Payment-Dis-Account

Conversation

@neeleshsinghal

@neeleshsinghal Fixes4BC (neeleshsinghal) commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes AB#653327

Fix : GL Account is now called from the General Posting Setup instead when Pmt Discount is Involved.

@neeleshsinghal
Fixes4BC (neeleshsinghal) requested a review from a team as a code owner October 7, 2026 12:02
@neeleshsinghal Fixes4BC (neeleshsinghal) changed the title Bugs/Bug 649383 NonDed ReverseVAT Posted to Payment Dis Account [Master]-Non-Deductible Reverse-Charge VAT Correction Is Posted to Purchase VAT Account Instead of Payment Discount Account. - Copy Oct 7, 2026
@github-actions github-actions Bot added the Team: Finance GitHub request for Finance area label Oct 7, 2026
@github-actions github-actions Bot added this to the Version 30.0 milestone Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Style}$

The new parameter is named VatEntry2, while the surrounding code and the call site consistently use the established VATEntry2 casing for the VAT acronym. Rename the parameter to VATEntry2 to preserve the codebase's AL identifier convention.

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

    local procedure GetPaymentDiscountVATExclNonDedVATAccountNo(VATEntry2: Record "VAT Entry"; NonDedVATAmount: Decimal): Code[20]

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

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.48.6

Comment thread src/Layers/RU/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al Outdated
<!--
Thanks for contributing to BCApps!

A few things before you hit "Create pull request":
- Your PR must link to an approved issue. New here? See CONTRIBUTING.md.
- You must have built and run your change yourself. CI is a safety net,
not a substitute.
- If you used AI or an agent to write this PR, you are still the author.
Read the diff,
  build it, and try it before requesting review.

Contributing guide:
https://github.com/microsoft/BCApps/blob/main/CONTRIBUTING.md
Local dev environment:
https://github.com/microsoft/BCApps/blob/main/LOCAL_DEV_ENV.md
-->

## What & why

<!-- A few sentences: what does this change do, and what problem does it
solve? -->

## Linked work

<!-- Required: link an approved GitHub issue using "Fixes #<number>".
Microsoft contributors: also link the ADO work item with "AB#<number>"
if you have one. -->

Fixes #

## 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)*

<!-- Example:
- Ran the new "Post and Send" action on a sales invoice in a fresh
container; document posted and email queued (see screenshot).
- New unit tests in MyFeatureTest.Codeunit.al pass locally; full module
test suite green.
- No tests added because change is comment-only / refactor with existing
coverage. -->

## Risk & compatibility

<!-- Anything reviewers should watch for: breaking changes, upgrade/data
impact, permissions,
telemetry, feature flags, follow-up work. Write "None" if there's
nothing to call out. -->
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Request Changes

What this PR does

This change routes the non-deductible part of a reverse-charge VAT payment-discount correction to the purchase payment-discount account instead of the purchase VAT account. The account selection matches the existing vendor posting logic, and the updated test covers the reported application scenario. However, the RU layer contains a malformed adaptation and cannot build.

Problem-solution fit

Fit: Strong

The change targets the incorrect G/L account allocation directly and preserves the existing behavior for other adjustment entry types. The RU implementation must be corrected before the solution works across all changed layers.

Suggestions

S1 (🔴 High): Restore the RU-specific argument
The standalone expression is invalid AL, and the preceding InitGLEntryVAT call lost its existing Trans. VAT Type argument. Restore the expression as the final argument of that call; otherwise the RU layer cannot build.

Risk assessment and necessity

Risk: This changes financial posting across multiple layers. The main implementation is narrow and has regression coverage, but the malformed RU copy is a build blocker and also drops an existing transaction VAT flag from the changed call.

Necessity: The fix is required because the current behavior assigns the non-deductible correction to the wrong G/L account. Without it, payment-discount posting produces an incorrect account allocation.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12474 round=1 by=alexei-dobriansky at=2026-10-07T13:22:34.9188178Z lastSha=6b582a54276533fb1222a82ed6cc7166c2c52a13 reviewKey=c542329e0e03f1e0b12896ebb913d63c9fbfac96b832b9c39d44cbec2277f077 suggestions=S1@2cf4b680

Comment thread src/Layers/RU/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al Outdated
Co-authored-by: neeleshsinghal <241776335+neeleshsinghal@users.noreply.github.com>
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 2

Recommendation: Accept

What this PR does

This change sends the non-deductible part of a reverse-charge VAT payment-discount correction to the purchase payment-discount account instead of the purchase VAT account. The deductible correction and the reverse-charge counterpart retain their existing accounts and amounts.

The changes since round 1 repair the RU posting call. The transaction VAT flag is again its final argument, with the required comma, rather than a standalone expression. The call now matches the localized procedure signature and neighboring VAT calls. Review of all 12 changed files found no further correctness issue; the updated regression test checks the corrected account allocation and exact totals.

Problem-solution fit

Fit: Strong

The account selection directly fixes the reported payment-discount correction. The RU repair preserves its localized transaction VAT behavior without changing the intended allocation.

Status of previous suggestions
ID Title Status Author response
S1 Restore the RU-specific argument (🔴 High) Addressed The final call restores the Trans. VAT Type argument and its separating comma, and removes the standalone expression.
New observations (commits since round 1)

None — the changes address the previous suggestion.

Risk assessment and necessity

Risk: Financial posting remains a sensitive area, but the change is limited to account selection for non-deductible reverse-charge VAT payment discounts. The regional copies preserve their existing local behavior, and the shared customer and service posting paths are unchanged. Two independent review samples agreed that S1 is addressed and found no new issues. The frozen three-dot git diff --check passed; local AL compilation and runtime tests were not run. Current-head CI is not fully green; the inspected W1 integration failure is an expense-capabilities API HTTP 500, not this VAT path.

Necessity: Without the fix, the non-deductible VAT correction continues to use the purchase VAT account rather than the payment-discount account, leaving an incorrect G/L allocation. The RU repair is necessary to make the changed localized call valid.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12474 round=2 by=alexei-dobriansky at=2026-10-07T20:04:09.7649949Z lastSha=db346e6347a644c0daea1d5dd5bad8922e74c9a1 reviewKey=3c4bb66b6e6c4ec24f71d905671d4b64ae82a4107139879b304e83be91a34ab8 suggestions=S1@2cf4b680:addressed parentRound=1

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

@neeleshsinghal Fixes4BC (neeleshsinghal) changed the title [Master]-Non-Deductible Reverse-Charge VAT Correction Is Posted to Purchase VAT Account Instead of Payment Discount Account. - Copy [Master]-Non-Deductible Reverse-Charge VAT Correction Is Posted to Purchase VAT Account Instead of Payment Discount Account. Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

This branch was successfully deployed

1 active deployment
triage — db346e63 Deployed Oct 12, 2026 by neeleshsinghal via Classify team ownership #7424
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team: Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants