Utility: reset serial no status and warehouse

This commit is contained in:
nabinhait 2014-07-14 11:56:03 +05:30
parent 5c38488590
commit b0a8d000b1

View File

@ -198,6 +198,10 @@ def reset_serial_no_status_and_warehouse(serial_nos=[]):
for serial_no in serial_nos:
try:
sr = frappe.get_doc("Serial No", serial_no)
last_sle = sr.get_last_sle()
if flt(last_sle.actual_qty) > 0:
sr.warehouse = last_sle.warehouse
sr.via_stock_ledger = True
sr.save()
except: