From b0a8d000b1c1d7551fc37d6df8e95e1b37a5da94 Mon Sep 17 00:00:00 2001 From: nabinhait Date: Mon, 14 Jul 2014 11:56:03 +0530 Subject: [PATCH] Utility: reset serial no status and warehouse --- erpnext/utilities/repost_stock.py | 4 ++++ 1 file changed, 4 insertions(+) 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: