#13479 [29.x][ALL-E] Canceling a posted purchase invoice fails or misallocates item charges assigned to posted document types other than Purchase Receipts
Fixed a bug where canceling a posted purchase invoice could fail or reverse item charges incorrectly when charges were assigned to documents other than Purchase Receipts. The fix now handles all supported document types and uses the correct cost amount field for each.
- 10files
- 8AL files
- 3objects
Pull request · merged into releases/29.x (BC29) on 2026-11-30 by sanjmaurya · 10 files (+980 -124), 8 AL · fix · tier official · reviewed (checked by Opus)
What changed
- Canceling a posted purchase invoice now recreates item charge assignments for Purchase Receipt, Transfer Receipt, Purchase Return Shipment, Sales Shipment and Sales Return Receipt
- Cost Amount (Non-Invtbl.) is used for Purchase Return Shipment and Sales Shipment; Cost Amount (Actual) is used for the other targets
- Rounding is based only on supported value entries, so skipped targets no longer shift quantities to the remaining assignments
- Changes are in Copy Document Mgt. across several layers, with small edits to the purchase and sales item charge assignment codeunits
- Behaviour changes for users or extensions.
AL objects touched
- Codeunit 6620 “Copy Document Mgt.”, Base Application: modified
- Codeunit 5805 “Item Charge Assgnt. (Purch.)”, Base Application: modified
- Codeunit 5807 “Item Charge Assgnt. (Sales)”, Base Application: modified
src/Layers/IT/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al: modified, not in the BC29 snapshotsrc/Layers/NL/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al: modified, not in the BC29 snapshotsrc/Layers/RU/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al: modified, not in the BC29 snapshot
Context
- Work items: AB#657337
- Labels: Ownership: Needs Review, Team: Other
- Systems: platform, purchasing, sales
Possibly related
No source states these links: they share an object, a model read them, or a person found the same subject.
- Creating and Interacting with an OData V4 Bound Action — possibly related: touches Codeunit 6620 “Copy Document Mgt.”
- Extending Item Charges Distribution Methods — possibly related: touches Codeunit 5805 “Item Charge Assgnt. (Purch.)”
- Correct or cancel a posted sales invoice — possibly related: Explains canceling posted purchase invoices and automatic corrective document creation. (model-linked)
- Item Charges - Specification (report) — possibly related: Documents item charges specification and their posting in various document types. (model-linked)
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).