#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.
- 4files
- 2AL files
- 0objects
Pull request · 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 yetsrc/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).