Bug 641388: Fix WIP transfer remainder over-creation when open line quantity is reduced - #9797
Open
ChethanT wants to merge 1 commit into
Conversation
…uantity is reduced Root cause: GetOpenWIPTransferLineQtyBase summed "Quantity (Base)" on open WIP transfer lines, but "Qty. per Unit of Measure" is force-set to 0 for WIP transfer lines (Subc. Transfer Line OnValidate(`Transfer WIP Item`)), which makes "Quantity (Base)" always evaluate to 0 for these lines. As a result, re-running "Create Transfer Order to Subcontractor" after reducing an open WIP transfer line's quantity never saw the existing reduced quantity as "open", and created a brand new line for the full amount instead of only the remainder. Fix: compute the open quantity from "Quantity" (which is correctly maintained) and convert it to the item's base UOM ourselves, using the same Purchase Line unit-of-measure conversion used elsewhere in this report (CalcPurchLineQtyBase / InsertWIPTransferLine). Re-enables the regression test WIPTransferRemainderCreatedWhenOpenLineQuantityReduced (added by the bug 639382 fix, temporarily disabled by this bug) in src/DisabledTests/Subcontracting_Test/Subcontracting_Test.DisabledTest.json. Co-authored-by: Copilot <[email protected]>
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.
Summary
WIPTransferRemainderCreatedWhenOpenLineQuantityReduced(added by the bug 639382 fix) started failing once CI actually ran it, and was temporarily disabled to unblock the pipeline.GetOpenWIPTransferLineQtyBaseinSubc. Create Transf. Ordersummed"Quantity (Base)"on open (unposted) WIP transfer lines. But"Qty. per Unit of Measure"is force-set to0for WIP transfer lines (seeSubc. Transfer Line.OnValidate("Transfer WIP Item")), which makes"Quantity (Base)"always evaluate to0for these lines regardless of the actual quantity. So after reducing an open WIP transfer line's quantity and re-running Create Transfer Order to Subcontractor, the existing (reduced) quantity was never counted as "already covered", and the report inserted a brand-new line for the full amount again instead of only the remainder.Quantity(which is correctly maintained) instead of the always-zero"Quantity (Base)", and convert it to the item's base UOM ourselves using the same Purchase Line unit-of-measure factor used elsewhere in the report (CalcPurchLineQtyBase/InsertWIPTransferLine).src/DisabledTests/Subcontracting_Test/Subcontracting_Test.DisabledTest.json.Test
Re-enabled and validated \WIPTransferRemainderCreatedWhenOpenLineQuantityReduced\ ([SCENARIO 639382], codeunit 149911). Also ran the full
Subc. WIP Trans. Create Test(149911) suite (19 tests) — all pass, no regressions.Assert.AreEqual failed. Expected:<6> (Decimal). Actual:<8> (Decimal). Re-running Create Transfer Order must create the remaining WIP quantity after the open line was reduced.Fixes AB#641388
🤖 Generated with GitHub Copilot