diff --git a/erpnext/utilities/repost_stock.py b/erpnext/utilities/repost_stock.py index 1c6782ad36..4205893893 100644 --- a/erpnext/utilities/repost_stock.py +++ b/erpnext/utilities/repost_stock.py @@ -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: