fix: from_warehouse getting set to None (#26920)
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 8293319..7b31d2f 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -1185,7 +1185,7 @@
wo = frappe.get_doc("Work Order", self.work_order)
wo_items = frappe.get_all('Work Order Item',
filters={'parent': self.work_order},
- fields=["item_code", "required_qty", "consumed_qty", "transferred_qty"]
+ fields=["item_code", "source_warehouse", "required_qty", "consumed_qty", "transferred_qty"]
)
work_order_qty = wo.material_transferred_for_manufacturing or wo.qty
@@ -1205,7 +1205,7 @@
if qty > 0:
self.add_to_stock_entry_detail({
item.item_code: {
- "from_warehouse": wo.wip_warehouse,
+ "from_warehouse": wo.wip_warehouse or item.source_warehouse,
"to_warehouse": "",
"qty": qty,
"item_name": item.item_name,
@@ -1857,4 +1857,4 @@
supplied_item.total_supplied_qty = flt(supplied_item.supplied_qty) - flt(supplied_item.returned_qty)
- return supplied_item_details
\ No newline at end of file
+ return supplied_item_details