repost stock due to incorrect packing list
diff --git a/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py b/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py
index a96d37b..9e9da7f 100644
--- a/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py
+++ b/erpnext/patches/july_2012/repost_stock_due_to_wrong_packing_list.py
@@ -3,7 +3,7 @@
bins = webnotes.conn.sql("select item_code, warehouse, name, reserved_qty from `tabBin`")
for d in bins:
reserved_qty = webnotes.conn.sql("""
- select sum((dnpi.qty/so_item.qty)*(so_item.qty - ifnull(so_item.delivered_qty, 0)))
+ select sum((dnpi.qty/so_item.qty)*(so_item.qty - ifnull(so_item.delivered_qty, 0))), so.transaction_date
from `tabDelivery Note Packing Item` dnpi, `tabSales Order Item` so_item, `tabSales Order` so
@@ -17,12 +17,13 @@
and dnpi.item_code = %s
and dnpi.warehouse = %s
""", (d[0], d[1]))
- if flt(d[3]) != reserved_qty:
+ if flt(d[3]) != flt(reserved_qty[0][0]):
print d, reserved_qty
- # webnotes.conn.sql("""
- # update `tabBin` set reserved_qty = %s where name = %s
- # """, (reserved_qty and reserved_qty[0][0] or 0, d[2]))
+ #webnotes.conn.sql("""
+ # update `tabBin` set reserved_qty = %s where name = %s
+ #""", (reserved_qty and reserved_qty[0][0] or 0, d[2]))
+repost_reserved_qty()
def cleanup_wrong_sle():
sle = webnotes.conn.sql("""