#13112 [Main][ALL-E] Canceling a posted purchase invoice fails or misallocates item charges assigned to posted document types other than Purchase ReceiptsInitial commit
Fixed a bug where canceling a posted purchase invoice could fail or misallocate item charges when those charges were assigned to documents other than Purchase Receipts. The fix ensures all supported document types are handled and correct cost amounts are used.
- 10files
- 8AL files
- 3objects
Pull request · merged into main (BC30) on 2026-11-25 by sanjmaurya · 10 files (+982 -124), 8 AL · fix · tier official · reviewed (checked by Opus)
What changed
- Item charge assignments are now recreated for all supported targets (Purchase Receipt, Transfer Receipt, Purchase Return Shipment, Sales Shipment, Sales Return Receipt) during corrective document creation
- Correct cost amount types are applied based on document type: Cost Amount (Non-Invtbl.) for Purchase Return Shipment and Sales Shipment; Cost Amount (Actual) for others
- Rounding adjustments now only affect supported value entries, preventing quantities from shifting to incorrect assignments
- Changes applied across all localization layers (W1, ES, IT, NA, NL, RU)
- 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 BC30 snapshotsrc/Layers/NL/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al: modified, not in the BC30 snapshotsrc/Layers/RU/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al: modified, not in the BC30 snapshot
Context
- Work items: AB#653898
- Labels: Ownership: Needs Review, Team: Other
- Systems: platform, purchasing, sales
- From the description: “Canceling a posted purchase invoice fails or misallocates item charges assigned to posted document types other than Purchase Receipts”
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: Documents canceling posted invoices and automatic creation of corrective credit memos for purchases. (model-linked)
- Item Charges - Specification (report) — possibly related: Item Charges - Specification report shows posted item charges, relevant to item charge allocation issues. (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).