fix(stock): set stock_uom on transferred Stock Reservation Entries

StockReservation.transfer_reservation_entries_to() created the transferred SREs without copying stock_uom, in both the entries_to_reserve dict and the extra-items fallback. get_items_to_reserve() already selects the item's stock_uom, so entry.stock_uom is used.

On sites with a global default stock_uom (e.g. "Nos"), frappe's _set_defaults() backfilled the blank field, so the transfer silently stored the wrong UOM for any item whose stock UOM is not the default. On sites without that default the SRE's validate_mandatory() raised "Stock UOM is required", aborting Work Order submission for the Subcontracting Inward Order / Production Plan flows.
This commit is contained in:
PranavDarade
2026-07-05 20:03:56 +05:30
parent d1d3b241ae
commit 5991ecfa3d

View File

@@ -1316,6 +1316,7 @@ class StockReservation:
"voucher_type": entry.voucher_type or to_doctype,
"voucher_no": entry.voucher_no,
"voucher_detail_no": entry.voucher_detail_no,
"stock_uom": entry.stock_uom,
"serial_nos": [],
"sre_names": defaultdict(float),
"batches": defaultdict(float),
@@ -1373,6 +1374,7 @@ class StockReservation:
sre.voucher_qty = entry.required_qty
sre.item_code = entry.item_code
sre.warehouse = entry.warehouse
sre.stock_uom = entry.stock_uom
sre.reserved_qty = min(sre.available_qty, entry.qty)
sre.has_serial_no = frappe.get_value("Item", sre.item_code, "has_serial_no")
sre.has_batch_no = frappe.get_value("Item", sre.item_code, "has_batch_no")