[fix] repost qty only for bin items
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index 8e7941c..5d0951b 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -195,11 +195,8 @@
existing_allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock")
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
- for item in frappe.db.sql("""select distinct item_code from (
- select name as item_code from `tabItem` where is_stock_item=1
- union
- select distinct item_code from tabBin) a"""):
- repost_stock(item[0], newdn)
+ for item in frappe.db.sql(""" select distinct item_code from tabBin where warehouse = %s""", newdn):
+ repost_stock(item[0], newdn)
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock)
frappe.db.auto_commit_on_many_writes = 0