#9656 [main] - Incorrect Prepayment Invoice Amount for Sales Orders with Invoice Discount, Prices Including VAT and negative non-inventory line.
Fixes incorrect prepayment invoice amounts for sales orders with invoice discounts, prices including VAT, and negative non-inventory lines by computing expected prepayment amounts line-by-line instead of from the order header.
- 12files
- 9AL files
- 1objects
Pull request · merged into main (BC30) on 2026-08-11 by v-ankitgoyal · 12 files (+745 -23), 9 AL · fix · tier official · reviewed (checked by Opus)
What changed
- Prepayment calculation now uses each line’s Amount and Prepayment % instead of header-level amounts
- Excludes negative and non-prepayment lines from prepayment base calculation
- Handles mixed prepayment percentages correctly across order lines
- Rounding correction only applies when there is genuine rounding surplus
- Fixes regression where posted prepayment invoices were understated
- Behaviour changes for users or extensions.
AL objects touched
- Codeunit 442 “Sales-Post Prepayments”, Base Application: modified
src/Layers/BE/BaseApp/Sales/Posting/SalesPostPrepayments.Codeunit.al: modified, not in the BC30 snapshotsrc/Layers/CH/BaseApp/Sales/Posting/SalesPostPrepayments.Codeunit.al: modified, not in the BC30 snapshotsrc/Layers/ES/BaseApp/Sales/Posting/SalesPostPrepayments.Codeunit.al: modified, not in the BC30 snapshotsrc/Layers/NL/BaseApp/Sales/Posting/SalesPostPrepayments.Codeunit.al: modified, not in the BC30 snapshot
Context
- Work items: AB#643210
- Labels: Team: SCM
- Systems: sales
- From the description: “Compute the expected prepayment amount line by line from the actual prepayment lines, using each line’s own Amount and Prepayment %”
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).