Skip to content

[29.x][ALL-E] Canceling a posted purchase invoice fails or misallocates item charges assigned to posted document types other than Purchase Receipts - #13479

Open
sanjmaurya wants to merge 2 commits into
releases/29.xfrom
bugs/Bug-657337-29x-CancelingpostedpurchaseinvoicefailsormisallocatesitemN
Open

sanjmaurya wants to merge 2 commits into
releases/29.xfrom
bugs/Bug-657337-29x-CancelingpostedpurchaseinvoicefailsormisallocatesitemN

Conversation

@sanjmaurya

@sanjmaurya sanjmaurya commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction Team: Other GitHub request for other area than SCM, Finance or Integration labels Oct 31, 2026
@github-actions github-actions Bot added this to the Version 29.1 milestone Oct 31, 2026
@sanjmaurya
sanjmaurya marked this pull request as ready for review November 3, 2026 12:44
@sanjmaurya
sanjmaurya requested a review from a team November 3, 2026 12:44
@sanjmaurya
sanjmaurya requested a review from a team as a code owner November 3, 2026 12:44
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

v-ankitgoyal
v-ankitgoyal previously approved these changes Nov 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

This branch was successfully deployed

1 active deployment
triage — 9c8f72b1 Deployed Nov 30, 2026 by sanjmaurya via Classify team ownership #12334
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction Team: Other GitHub request for other area than SCM, Finance or Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants