Skip to content

(Bug 636078): [Subcontracting] Worksheet pricing passes total base qty instead of qty-per-UoM to ConvertPriceToUOM — wrong Direct Unit Cost#8286

Open
alexei-dobriansky wants to merge 1 commit into
mainfrom
bugs/636078-Subcon_MissingUOMConvertionWrongUnitCost
Open

(Bug 636078): [Subcontracting] Worksheet pricing passes total base qty instead of qty-per-UoM to ConvertPriceToUOM — wrong Direct Unit Cost#8286
alexei-dobriansky wants to merge 1 commit into
mainfrom
bugs/636078-Subcon_MissingUOMConvertionWrongUnitCost

Conversation

@alexei-dobriansky
Copy link
Copy Markdown
Contributor

@alexei-dobriansky alexei-dobriansky commented May 22, 2026

Summary

Fixes the Subcontracting Worksheet Direct Unit Cost when the production order UoM differs from the subcontractor price-list UoM.

Subc. Price Management.GetSubcPriceForReqLine passed RequisitionLine.GetQuantityBase() (total base quantity of the order) as the per-UoM conversion factor to ConvertPriceToUOM. Because ConvertPriceToUOM computes DirectCost := PriceListCost / PriceListQtyPerUOM * ProdQtyPerUoM, the result was multiplied by the order quantity instead of the UoM conversion factor. The Carry-Out Action Message-created Purchase Order then inherited the inflated cost.

Comparison of the three call sites (only the worksheet path was wrong):

Path 2nd param Correct?
Routing (SetRoutingPriceListCost) ProdQtyPerUom Yes
Worksheet (GetSubcPriceForReqLine) RequisitionLine.GetQuantityBase() No (fixed here)
Purchase Order (GetSubcPriceForPurchLine) PurchaseLine.GetQuantityPerUOM() Yes

Fix

Pass RequisitionLine.GetQuantityForUOM() instead, matching the routing and purchase paths.

Test

Added WorksheetDirectUnitCostUsesQtyPerUoMNotBaseQtyForUoMConversion in SubcSubcontractingTest:

  • Item with PCS base UoM + SET alternative UoM (10 PCS per SET), vendor and work center with that vendor as subcontractor, subcontractor price of 1000 / PCS.
  • Stages a Requisition Line for 3 SET (= 30 PCS base) and asserts Direct Unit Cost = 10000 (price * Qty-per-UoM), not 30000 (pre-fix behavior).
  • Also asserts the same-UoM (PCS) path still returns 1000 - guards against regression.

Work Item

AB#636078

…rice list

GetSubcPriceForReqLine passed RequisitionLine.GetQuantityBase() (total base qty) as the per-UoM factor to ConvertPriceToUOM, so the Direct Unit Cost on the Subcontracting Worksheet was multiplied by the order quantity whenever the order UoM differed from the price-list UoM. The PO created from carry-out inherited the inflated cost.

Fix: pass RequisitionLine.GetQuantityForUOM() instead, matching the routing (SetRoutingPriceListCost) and purchase (GetSubcPriceForPurchLine) call sites.

AB#636078

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@alexei-dobriansky alexei-dobriansky requested a review from a team as a code owner May 22, 2026 13:07
@alexei-dobriansky alexei-dobriansky self-assigned this May 22, 2026
@alexei-dobriansky alexei-dobriansky changed the title Fix Subcontracting Worksheet Direct Unit Cost when UoM differs from price list (Bug 636078): [Subcontracting] Worksheet pricing passes total base qty instead of qty-per-UoM to ConvertPriceToUOM — wrong Direct Unit Cost May 22, 2026
@alexei-dobriansky alexei-dobriansky enabled auto-merge (squash) May 22, 2026 13:10
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label May 22, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone May 22, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant