Propagate projected_qty all the way to the root warehouse to make 'check in group' actually work for more complex warehouse topologies (#10842)
diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py
index 01a6a6d..46b8840 100644
--- a/erpnext/stock/reorder_item.py
+++ b/erpnext/stock/reorder_item.py
@@ -90,11 +90,12 @@
warehouse_doc = frappe.get_doc("Warehouse", warehouse)
- if warehouse_doc.parent_warehouse:
+ while warehouse_doc.parent_warehouse:
if not item_warehouse_projected_qty.get(item_code, {}).get(warehouse_doc.parent_warehouse):
item_warehouse_projected_qty.setdefault(item_code, {})[warehouse_doc.parent_warehouse] = flt(projected_qty)
else:
item_warehouse_projected_qty[item_code][warehouse_doc.parent_warehouse] += flt(projected_qty)
+ warehouse_doc = frappe.get_doc("Warehouse", warehouse_doc.parent_warehouse)
return item_warehouse_projected_qty