Skip to content

[Main]Incorrect Country/Region Code in VAT Entry after applying Alternative Customer VAT Registration on a Sales Invoice in the Belgian version. - #13315

Open
Shikhverma wants to merge 4 commits into
mainfrom
bugs/Bug-656881--Main]IncorrectCountryRegionCodeInVATEntry
Open

Shikhverma wants to merge 4 commits into
mainfrom
bugs/Bug-656881--Main]IncorrectCountryRegionCodeInVATEntry

Conversation

@Shikhverma

@Shikhverma Shikhverma commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Bug 656881: [Main] [all-e]Incorrect Country/Region Code in VAT Entry after applying Alternative Customer VAT Registration on a Sales Invoice in the Belgian version.

Fixes AB#656881

@github-actions github-actions Bot added the Team: Finance GitHub request for Finance area label Oct 27, 2026
@github-actions github-actions Bot added this to the Version 30.0 milestone Oct 27, 2026
Co-authored-by: Shikhverma <241284522+Shikhverma@users.noreply.github.com>
@github-actions github-actions Bot added needs-approval Workflow runs require maintainer approval to start and removed needs-approval Workflow runs require maintainer approval to start labels Oct 27, 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.

@Shikhverma
Shikhverma marked this pull request as ready for review November 2, 2026 03:38
@Shikhverma
Shikhverma requested a review from a team as a code owner November 2, 2026 03:38
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept

What this PR does

Changes Belgian sales invoice posting to take the general journal line's Country/Region Code from the sales header's VAT Country/Region Code instead of reloading the bill-to customer's country. This removes the overwrite that caused an alternative VAT registration number to be paired with the original customer country. At the pinned head, CopyFromSalesHeader already copies the document VAT country and registration number; the changed assignment now preserves that pairing, InvoicePostingBuffer.CopyToGenJnlLine does not replace the country, and VAT Entry.CopyFromGenJnlLine copies both values into the VAT entry. The existing IsHandled event remains in the same position with the same signature and override behavior.

Problem-solution fit

Fit: Strong

The reported failure is the Belgian posting-specific replacement of the document VAT country with the customer country. The fix changes exactly that source, and the three added posting tests cover alternative registrations for domestic and foreign customers plus an ordinary invoice without an alternative registration.

Suggestions

None.

Risk assessment and necessity

Risk: The affected path creates financial ledger data, so incorrect country selection would affect VAT reporting. The implementation change is narrow: it changes only the default country assignment in Belgian Sales Post Invoice, leaves amounts and posting groups untouched, retains the existing event override, and changes no public signatures or schema. W1 sales, Belgian purchase, and W1 service posting already use the document VAT country. The tests assert the exact country and VAT registration number on every matching posted invoice VAT entry and require at least one entry.

Necessity: The fix is needed because affected invoices otherwise retain the customer's original country in VAT entries despite using an alternative VAT registration number, producing an inconsistent country/registration pair and incorrect VAT-VIES reporting. Avoiding alternative registrations is not a suitable workaround when a transaction requires one; affected posting would need to be deferred or reporting corrected separately. The small Belgian-only change is proportionate to the defect.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=13315 round=1 by=alexei-dobriansky at=2026-11-02T10:35:24.7150600Z lastSha=35a85862712236d915c87de5eb5336b706d2a0d3 reviewKey=f5c25315a9eca5ce4dd6b1903285ba74df961860f1039fb109b7eb9d9a448074 suggestions=

This branch was previously deployed

1 inactive deployment
triage — 35a85862 Deployed Nov 2, 2026 by Shikhverma via Classify team ownership #9665
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.

4 participants