---
id: change/bcapps/11852
type: change
title: "#11852 [main] Allocation Accounts with Invoice Discount produces wrong posted entries in Sales and Purchases documents in the Spanish version."
summary: Fixed incorrect posted entries when allocation accounts are used with invoice discounts in Spanish Sales and Purchase documents. The allocation logic now correctly uses the pre-discount line amount instead of the already-discounted amount.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
system: finance
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:03:52.830Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 9f38f8a0d3422e150104a4887342a461f0c7f24c
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/11852
    title: "microsoft/BCApps#11852: [main] Allocation Accounts with Invoice Discount produces wrong posted entries in Sales and Purchases documents in the Spanish version."
    date: "2026-09-29"
    commit: 9f38f8a0d3422e150104a4887342a461f0c7f24c
    t: null
    quote: Invoice discount was being applied twice, producing incorrect posted entries.
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 11852
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/11852
kind: pr
base_branch: main
major: "30"
merged_at: "2026-09-29T14:28:24Z"
author: Shikhverma
author_type: User
community_contribution: false
labels:
  - "Team: Finance"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 4
  additions: 2134
  deletions: 7
  al: 2
apps: []
objects_touched: []
objects_unjoined:
  - path: src/Layers/ES/BaseApp/Finance/AllocationAccount/Purchase/PurchaseAllocAccMgt.Codeunit.al
    status: added
    reason: not-in-snapshot
  - path: src/Layers/ES/BaseApp/Finance/AllocationAccount/Sales/SalesAllocAccMgt.Codeunit.al
    status: added
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 650386
systems:
  - finance
  - localization
quote: Invoice discount was being applied twice, producing incorrect posted entries.
joined_against:
  major: "30"
  commit: f18567dc08e2bd162bf192e1da4d714b57eb099f
---

# #11852 [main] Allocation Accounts with Invoice Discount produces wrong posted entries in Sales and Purchases documents in the Spanish version.

> Fixed incorrect posted entries when allocation accounts are used with invoice discounts in Spanish Sales and Purchase documents. The allocation logic now correctly uses the pre-discount line amount instead of the already-discounted amount.

[Pull request](https://github.com/microsoft/BCApps/pull/11852) · merged into `main` (BC30) on 2026-09-29 by Shikhverma · 4 files (+2134 -7), 2 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Invoice discount was being applied twice to allocation accounts in Spanish documents
- The root cause was using the already-discounted Amount field instead of the pre-discount Line Amount in allocation calculations
- This fix ensures allocation accounts produce correct posted entries for both Sales and Purchase documents
- Test cases were added to verify the fix
- Behaviour changes for users or extensions.

## AL objects touched

- `src/Layers/ES/BaseApp/Finance/AllocationAccount/Purchase/PurchaseAllocAccMgt.Codeunit.al`: added, not in the BC30 snapshot yet
- `src/Layers/ES/BaseApp/Finance/AllocationAccount/Sales/SalesAllocAccMgt.Codeunit.al`: added, not in the BC30 snapshot yet

## Context

- Work items: AB#650386
- Labels: Team: Finance
- Systems: finance, localization
- From the description: "Invoice discount was being applied twice, producing incorrect posted entries."

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).
