Skip to content

Source Currency Inconsistency for LCY Postings and cash posting on sales documents - #10246

Open
Anders (AndersLarsenMicrosoft) wants to merge 36 commits into
mainfrom
bugs/646791
Open

Source Currency Inconsistency for LCY Postings and cash posting on sales documents#10246
Anders (AndersLarsenMicrosoft) wants to merge 36 commits into
mainfrom
bugs/646791

Conversation

@AndersLarsenMicrosoft

@AndersLarsenMicrosoft Anders (AndersLarsenMicrosoft) commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What & why

Source Currency Inconsistency for LCY Postings and cash posting on sales documents. Please note that in APAC we fix for WHT instead of VAT

The issue is for posting an invoice with cash payment - then the payment entry doesn't have the3 correct source currency amount

Linked work

Fixes AB#646791

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

@github-actions github-actions Bot added the Team: Finance GitHub request for Finance area label Aug 14, 2026
Comment thread src/Layers/W1/Tests/ERM-Finance/ERMSourceCurrency.Codeunit.al
Co-authored-by: AndersLarsenMicrosoft <28434119+AndersLarsenMicrosoft@users.noreply.github.com>
@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Aug 18, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Aug 18, 2026
@github-actions github-actions Bot removed the needs-approval Workflow runs require maintainer approval to start label Aug 18, 2026
@github-actions github-actions Bot added the Build: scripts & configs Build scripts and configuration files label Aug 20, 2026
@AndersLarsenMicrosoft
Anders (AndersLarsenMicrosoft) marked this pull request as ready for review August 20, 2026 11:22
@AndersLarsenMicrosoft
Anders (AndersLarsenMicrosoft) requested a review from a team August 20, 2026 11:22
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Reply

Thanks for the details. Response to your point:

  • S1 - Hold. The APAC branch is WHT-aware, but the same helper still adds WHT on top of the source-currency VAT base when source currency exists. In the blank-source-currency path, Amount - WHTAmountLCY does not preserve that VAT-base-plus-WHT formula.

[AI-PR-REPLY] version=1 promptVersion=4 system=github pr=10246 reviewRound=5 by=alexei-dobriansky at=2026-08-30T13:12:43Z respondsTo=2026-08-30T11:01:48Z reviewKey=fe540407d9423022f250ef5f9342065b1b06f2fa8daf278de93eb5192a90c18d

@AndersLarsenMicrosoft

Anders (AndersLarsenMicrosoft) commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Good Sense Reviewer - Reply

Thanks for the details. Response to your point:

  • S1 - Hold. The APAC branch is WHT-aware, but the same helper still adds WHT on top of the source-currency VAT base when source currency exists. In the blank-source-currency path, Amount - WHTAmountLCY does not preserve that VAT-base-plus-WHT formula.

[AI-PR-REPLY] version=1 promptVersion=4 system=github pr=10246 reviewRound=5 by=alexei-dobriansky at=2026-08-30T13:12:43Z respondsTo=2026-08-30T11:01:48Z reviewKey=fe540407d9423022f250ef5f9342065b1b06f2fa8daf278de93eb5192a90c18d

Code is updated

Comment thread src/Layers/W1/Tests/ERM-Finance/ERMSourceCurrency.Codeunit.al
Comment thread src/Layers/RU/Tests/ERM-Finance/ERMSourceCurrency.Codeunit.al
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 6

Recommendation: Request Changes

What this PR does

This PR changes the source-currency VAT-base calculation in Gen. Jnl.-Post Line so LCY sales cash postings avoid conversion through a blank source currency. Since round 5, APAC changed the non-blank-source-currency fallback to return Source Currency Amount directly. That does not change the blank-source-currency path, so the open APAC VAT-base problem remains.

Status of previous suggestions
ID Title Status Author response
S1 Update the APAC posting path Not addressed No new reply. The new APAC edit changes the non-blank-source-currency fallback only; the blank Source Currency Code branch still returns Amount - WHTAmountLCY.
S2 W1 blank-currency guard not applied to localizations Addressed No new reply; the current net diff still keeps the blank-currency guard in the localization copies.
New observations (commits since round 5)

None - the new commit only touches the existing APAC source-currency helper, and it is covered by S1 above.

Risk assessment and necessity

Risk: This is still a financial posting path that feeds source-currency VAT-base values into G/L entries. If the APAC blank-currency branch stays as Amount - WHTAmountLCY, LCY postings with VAT can still write a VAT base that is too high.

Necessity: The LCY sales cash-posting scenario is valid and important because it affects source-currency consistency during posting. The fix is still necessary, but the APAC copy should preserve the VAT-base calculation before merge.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10246 round=6 by=alexei-dobriansky at=2026-08-31T13:25:07Z lastSha=a882112a8ba8d81471efe5776e06d5d575f3cf1a reviewKey=c9cd7af854c3df4d4445162346a3bc749622315efeb20dab2d2a03d43ef5c94d suggestions=S1@9ab5e3e8:notaddressed,S2@3b71b029:addressed parentRound=5

@AndersLarsenMicrosoft

Anders (AndersLarsenMicrosoft) commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Good Sense Reviewer - Round 6

Recommendation: Request Changes

What this PR does
This PR changes the source-currency VAT-base calculation in Gen. Jnl.-Post Line so LCY sales cash postings avoid conversion through a blank source currency. Since round 5, APAC changed the non-blank-source-currency fallback to return Source Currency Amount directly. That does not change the blank-source-currency path, so the open APAC VAT-base problem remains.

Status of previous suggestions
ID Title Status Author response
S1 Update the APAC posting path Not addressed No new reply. The new APAC edit changes the non-blank-source-currency fallback only; the blank Source Currency Code branch still returns Amount - WHTAmountLCY.
S2 W1 blank-currency guard not applied to localizations Addressed No new reply; the current net diff still keeps the blank-currency guard in the localization copies.
New observations (commits since round 5)
None - the new commit only touches the existing APAC source-currency helper, and it is covered by S1 above.

Risk assessment and necessity
Risk: This is still a financial posting path that feeds source-currency VAT-base values into G/L entries. If the APAC blank-currency branch stays as Amount - WHTAmountLCY, LCY postings with VAT can still write a VAT base that is too high.

Necessity: The LCY sales cash-posting scenario is valid and important because it affects source-currency consistency during posting. The fix is still necessary, but the APAC copy should preserve the VAT-base calculation before merge.

[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=10246 round=6 by=alexei-dobriansky at=2026-08-31T13:25:07Z lastSha=a882112a8ba8d81471efe5776e06d5d575f3cf1a reviewKey=c9cd7af854c3df4d4445162346a3bc749622315efeb20dab2d2a03d43ef5c94d suggestions=S1@9ab5e3e8:notaddressed,S2@3b71b029:addressed parentRound=5

I would clame that the suggested fix is correct. The change does not update the VAT base amount at all only the source currency amount. so there is no VAT-base problem

If you see any issue in this

It is in case there is either VAT or WHT
if GenJnlLine."Source Currency Code" <> '' then begin
if GenJnlLine."Source Curr. VAT Base Amount" <> 0 then
exit(GenJnlLine."Source Curr. VAT Base Amount" + CalcAmountSrcCurr(GenJnlLine, WHTAmountLCY))
else

@github-actions

github-actions Bot commented Sep 4, 2026

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.

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.

10 participants