Repository navigation
[29.x][ALL-E] Canceling a posted purchase invoice fails or misallocates item charges assigned to posted document types other than Purchase Receipts - #13479
Conversation
|
Predrag Maricic (PredragMaricic)
left a comment
There was a problem hiding this comment.
Recommendation: Approve with Suggestions.
Reviewed head 9c8f72b against linked bug 657337. No blocking correctness defect found.
The fix reconstructs assignments for all five supported posted targets, selects the cost field using ValueEntry.Inventoriable, preserves rebate proportions through the absolute unit-cost denominator, and prevents summarization from merging different document types with matching document and line numbers. Production changes match across ES, IT, NA, NL, RU, and W1; the W1 and IT test additions also match.
S1 - Add a non-zero rounding-residual regression test (non-blocking).
The new tests cover each target, unequal mixed assignments, an inbound sales shipment, and rebates, but use integer shares and costs. Please add a mixed-target case with fractional assignments or foreign currency that produces a non-zero residual and exercises the changed rounding correction. Assert the corrective cost against each original item ledger entry, as well as the assigned quantity total, so a redistribution error cannot pass through an unchanged document total. This is a coverage suggestion, not a reproduced production defect.
Validation: inspected the linked bug, diff, relevant copy and posting paths, regression tests, localization parity, and CI results (166 successful checks, 2 skipped). No independent AL build or runtime test execution was performed.
|
Bug 657337: [29.x][ALL-E] Canceling a posted purchase invoice fails or misallocates item charges assigned to posted document types other than Purchase Receipts
Fixes AB#657337
Issue: Canceling a posted purchase invoice can fail—or reverse item charges against the wrong entries—when charges were assigned to a posted document other than a Purchase Receipt.
Cause: Corrective-document logic in CopyFromPurchLineItemChargeAssign recreated assignments only for Purchase Receipt value entries. Other supported targets were skipped, and the rounding adjustment could redistribute their quantities across the assignments that remained. It also always used Cost Amount (Actual), which is incorrect for non-inventoriable charges.
Solutions:
Recreate assignments for all supported targets: Purchase Receipt, Transfer Receipt, Purchase Return Shipment, Sales Shipment, and Sales Return Receipt.
Use Cost Amount (Non-Invtbl.) for Purchase Return Shipment and Sales Shipment; use Cost Amount (Actual) for the other targets.
Base rounding on supported value entries only, so skipped targets do not shift the original