[Subcontracting] Use Base Unit of Measure for WIP Ledger Entries#8585
[Subcontracting] Use Base Unit of Measure for WIP Ledger Entries#8585stevengrossGOB wants to merge 3 commits into
Conversation
- Refactor fields in various codeunits and pages to replace "Unit of Measure Code" with "Base Unit of Measure". - Implement event subscriber to set quantity per unit of measure to zero for transfer WIP items. - Enhance test coverage for WIP transfer to ensure base unit of measure is used correctly.
| WIPLedgerEntry."In Transit" := InTransit; | ||
| WIPLedgerEntry."Unit of Measure Code" := ProdOrderLine."Unit of Measure Code"; | ||
| Item.SetLoadFields("Base Unit of Measure"); | ||
| if Item.Get(ItemNo) then |
There was a problem hiding this comment.
Incomplete WIP entry when Item.Get fails in library
The same silent-skip pattern used in production code is repeated in CreateWIPLedgerEntry: if Item.Get(ItemNo) fails, WIPLedgerEntry."Base Unit of Measure" is never set and the entry is inserted with a blank value. This can cause tests to pass even when the UOM field is empty, giving false confidence.
Recommendation:
- Either assert that the item must exist (using
Item.Get(ItemNo)with a direct error on failure) or useTestFieldafter the insert to verify the field was populated, ensuring the test library catches missing items early.
| if Item.Get(ItemNo) then | |
| Item.SetLoadFields("Base Unit of Measure"); | |
| Item.Get(ItemNo); | |
| WIPLedgerEntry."Base Unit of Measure" := Item."Base Unit of Measure"; | |
| WIPLedgerEntry.Insert(); |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
Stale cache returned when Item.Get fails
Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
Agentic PR Review - Round 1Recommendation: Accept with SuggestionsWhat this PR doesThis makes Subcontractor WIP Ledger Entries record the item's base unit of measure: field 8 on the table is renamed from SuggestionsS1 - Reconcile description with the actual diff S2 - Fail closed when the item lookup fails Risk assessment and necessityRisk: Low and contained to the Subcontracting WIP area ( Necessity: Justified — recording an alternative document UOM next to a base quantity was misleading on the WIP ledger entry and its adjustment/display pages; aligning the stored UOM with the base quantity is the correct, minimal fix, and it is covered by a meaningful regression test.
|
Head branch was pushed to by a user without write access
| [IntegrationEvent(false, false)] | ||
| local procedure OnBeforeInsertWIPLedgerEntry(var SubcontractorWIPLedgerEntry: Record "Subcontractor WIP Ledger Entry"; var WIPLedgEntryNo: Integer) | ||
| begin | ||
| end; No newline at end of file |
There was a problem hiding this comment.
| end; | |
| end; | |
| } |
What & why
Linked work
Internal workitem: AB#636809
How I validated this
What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)
-Manually changed document Unit of Measure - checked if Base Unit of Measure is set correctly