---
id: change/bcapps/10877
type: change
title: "#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"
summary: 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.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit sales post invoice
system: sales
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:06:09.832Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: f97b83bffeb26964068e66f801bcc41ab7540aea
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/10877
    title: "microsoft/BCApps#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"
    date: "2026-09-07"
    commit: f97b83bffeb26964068e66f801bcc41ab7540aea
    t: null
    quote: Source Currency VAT Amount is not zero when all three conditions are present.
links:
  learn: []
  objects:
    - object/codeunit/815
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 10877
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/10877
kind: pr
base_branch: main
major: "30"
merged_at: "2026-09-07T16:07:42Z"
author: v-praghav
author_type: User
community_contribution: false
labels:
  - "Team: SCM"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 13
  additions: 735
  deletions: 40
  al: 8
apps:
  - Base Application
objects_touched:
  - key: codeunit/815
    page: codeunit/815
    type: codeunit
    id: 815
    name: Sales Post Invoice
    app: Base Application
    status: modified
objects_unjoined:
  - path: src/Layers/BE/BaseApp/Sales/Posting/SalesPostInvoice.Codeunit.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/ES/BaseApp/Sales/Posting/SalesPostInvoice.Codeunit.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/FI/BaseApp/Sales/Posting/SalesPostInvoice.Codeunit.al
    status: modified
    reason: not-in-snapshot
  - path: src/Layers/RU/BaseApp/Sales/Posting/SalesPostInvoice.Codeunit.al
    status: modified
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 648518
systems:
  - sales
quote: Source Currency VAT Amount is not zero when all three conditions are present.
joined_against:
  major: "30"
  commit: f18567dc08e2bd162bf192e1da4d714b57eb099f
---

# #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](https://github.com/microsoft/BCApps/pull/10877) · 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"](../../objects/codeunit/815.md), 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).
