[fix] repost qty only for bin items

This commit is contained in:
Saurabh 2016-11-09 16:10:30 +05:30
parent ceca1b97c3
commit 7fbc00c9d6

View File

@ -195,11 +195,8 @@ class Warehouse(NestedSet):
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