[Subcontracting] [28.x] Item Charge for Last-Operation Subcontracting Receipt Linked to Wrong Ledger Entry#8808
Merged
alexei-dobriansky merged 3 commits intoJun 26, 2026
Conversation
alexei-dobriansky
previously approved these changes
Jun 25, 2026
auto-merge was automatically disabled
June 26, 2026 06:18
Head branch was pushed to by a user without write access
alexei-dobriansky
approved these changes
Jun 26, 2026
AleksandricMarko
approved these changes
Jun 26, 2026
PredragMaricic
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug: Item Charge for Last-Operation Subcontracting Receipt Linked to Wrong Ledger Entry
Scenario ID
AB#640042
Affected Objects
Reproduction Steps
False Behavior
ValueEntry."Item Ledger Entry No."points to an arbitrary, unrelated ILE whose entry number coincidentally equals the Capacity Ledger Entry number from the receipt — or posting fails with "The Item Ledger Entry does not exist". The production order reference and serial number on the linked ILE are wrong.Expected Behavior
Tracked items (serial / lot)
ValueEntry."Item Ledger Entry No."= Output ILE,"Capacity Ledger Entry No." = 0.Order Type = Production, correctOrder No.and serial number.Non-tracked items
ValueEntry."Capacity Ledger Entry No."= Capacity Ledger Entry from the service receipt,"Item Ledger Entry No." = 0.Order Type = Production, correctOrder No.Root Cause
CopySubcontractingProdOrderFieldsToItemJnlLineunconditionally setEntry Type = OutputandSubcontracting = trueon the item journal line — including for last-operation item charges. This routed posting throughPostOutput/InsertCapValueEntryregardless of item tracking, producing wrong value entry linkages.Tracked items
PurchRcptLine."Item Rcpt. Entry No." = 0for tracked items.PostItemChargePerRcptusesCollectItemEntryRelationto distribute the charge across each Output ILE. WithEntry Type = Outputstill set,PostOutputwas called per ILE using the Output ILE entry number as a Capacity Ledger Entry key → error or wrong entry.Non-tracked items
PurchRcptLine."Item Rcpt. Entry No." = CapLedgEntryNo. WithEntry Type = Purchase(default from Purch.-Post, before our code ran),PostItemcalledGlobalItemLedgEntry.Get(CapLedgEntryNo)— loading whichever ILE happened to carry that number.Fix
CopySubcontractingProdOrderFieldsToItemJnlLinenow distinguishes last-operation from non-last-operation and tracked from non-tracked:"Inventory Posting Group"and"Subc. Item Charge Assign."are set before the check for both paths.Related Work Items / PRs