#9984 [Main] Error with unposted prepayment amounts on Order
Fixed an error where unposted prepayment amounts on sales and purchase orders were calculated incorrectly when the quantity to invoice was modified, by making the prepayment deduction calculation idempotent across multiple trigger invocations.
- 30files
- 26AL files
- 2objects
Pull request · merged into main (BC30) on 2026-08-11 by sanjmaurya (community contribution) · 30 files (+338 -78), 26 AL · fix · tier official · reviewed (checked by Opus)
What changed
- The CalcPrepaymentToDeduct function was being called twice during Qty. to Invoice field updates, causing different rounding results based on the current field value
- Changed the calculation to reset the prepayment deduction field to zero before recomputing, ensuring deterministic simple-branch rounding each time
- The final invoice still applies proration logic to true up totals when marked as final
- Fix applied uniformly across all localization layers (W1, NA, BE, CH, DACH, ES, FI, GB, IT, NL, NO, RU, SE, APAC)
- Added comprehensive test cases for both sales and purchase prepayment rounding scenarios
- Behaviour changes for users or extensions.
AL objects touched
- Table 39 “Purchase Line”, Base Application: modified
- Table 37 “Sales Line”, Base Application: modified
src/Layers/BE/BaseApp/Sales/Document/SalesLine.Table.al: modified, not in the BC30 snapshot
Context
- Work items: AB#645184
- Labels: ADO: Sync, From Fork, Team: SCM
- Systems: purchasing, sales
- From the description: “Error with unposted prepayment amounts on Order”
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).