code change · fixSales & Receivablesofficial - Microsoftreviewed - checked by Opus

#10877 [MAIN]-Bug 648518 Source Currency VAT Amount is zero on G/L Entry when posting sales invoice with Line Discount Deferral Code and Discount Posting is No Discounts

Fixed Source Currency VAT Amount being posted as zero on G/L entries for sales invoices that combine a line discount, a deferral code and Discount Posting set to No Discounts. In that case the amount is now the calculated VAT, and source currency amounts balance across the G/L entries.

Pull request · merged into main (BC30) on 2026-09-07 by v-praghav · 13 files (+735 -40), 8 AL · fix · tier official · reviewed (checked by Opus)

What changed

  • Sales Post Invoice codeunit corrected in the W1 layer and several localized layers
  • With deferral, line discount and No Discounts combined, Source Currency VAT Amount now equals (Unit Price - Discount) x VAT%
  • Source Currency amounts balance to zero across the posted G/L entries
  • Tests added to ERM Source Currency in the W1, CZ, ES, IT and RU layers
  • Behaviour changes for users or extensions.

AL objects touched

  • Codeunit 815 “Sales Post Invoice”, Base Application: modified
  • src/Layers/BE/BaseApp/Sales/Posting/SalesPostInvoice.Codeunit.al: modified, not in the BC30 snapshot
  • src/Layers/ES/BaseApp/Sales/Posting/SalesPostInvoice.Codeunit.al: modified, not in the BC30 snapshot
  • src/Layers/FI/BaseApp/Sales/Posting/SalesPostInvoice.Codeunit.al: modified, not in the BC30 snapshot
  • src/Layers/RU/BaseApp/Sales/Posting/SalesPostInvoice.Codeunit.al: modified, not in the BC30 snapshot

Context

  • Work items: AB#648518
  • Labels: Team: SCM
  • Systems: sales
  • From the description: “Source Currency VAT Amount is not zero when all three conditions are present.”

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).