Skip to content

Bug 641388: Fix WIP transfer remainder over-creation when open line quantity is reduced - #9797

Open
ChethanT wants to merge 1 commit into
mainfrom
bugs/Subcontracting/bugs/641388-WIPTransferRemainderCreatedWhenOpenLineQuantityReduced
Open

Bug 641388: Fix WIP transfer remainder over-creation when open line quantity is reduced#9797
ChethanT wants to merge 1 commit into
mainfrom
bugs/Subcontracting/bugs/641388-WIPTransferRemainderCreatedWhenOpenLineQuantityReduced

Conversation

@ChethanT

@ChethanT ChethanT commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bug 641388: the regression test WIPTransferRemainderCreatedWhenOpenLineQuantityReduced (added by the bug 639382 fix) started failing once CI actually ran it, and was temporarily disabled to unblock the pipeline.
  • Root cause: GetOpenWIPTransferLineQtyBase in Subc. Create Transf. Order summed "Quantity (Base)" on open (unposted) WIP transfer lines. But "Qty. per Unit of Measure" is force-set to 0 for WIP transfer lines (see Subc. Transfer Line.OnValidate("Transfer WIP Item")), which makes "Quantity (Base)" always evaluate to 0 for 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.
  • Fix: compute the open quantity from 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).
  • Re-enabled the test by removing its entry from 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.

  • Baseline (before fix): test FAILS — 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.
  • After fix: test PASSES, and the full 19-test suite for codeunit 149911 passes.

Fixes AB#641388

🤖 Generated with GitHub Copilot

…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]>
@ChethanT
ChethanT requested review from a team July 28, 2026 13:08
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jul 28, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 28, 2026
@ChethanT ChethanT added the SCM GitHub request for SCM area label Jul 28, 2026
@ChethanT ChethanT closed this Jul 28, 2026
@ChethanT ChethanT reopened this Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant