From df1854f0b5f465eaf8bc5fb656d03362b8ef0cab Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Sep 2013 13:07:17 +0530 Subject: [PATCH] [fix] [minor] serial no status update for material transfer --- .../p02_fix_serial_no_status.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/patches/september_2013/p02_fix_serial_no_status.py b/patches/september_2013/p02_fix_serial_no_status.py index 8c91d72fb9..714cd7a377 100644 --- a/patches/september_2013/p02_fix_serial_no_status.py +++ b/patches/september_2013/p02_fix_serial_no_status.py @@ -15,14 +15,16 @@ def execute(): for d in stock_entries: serial_nos = d.serial_no.split("\n") - for serial_no in serial_nos: - serial_bean = webnotes.bean("Serial No", serial_no) - if serial_bean.doc.status == "Not Available": - latest_sle = webnotes.conn.sql("""select voucher_no from `tabStock Ledger Entry` - where item_code=%s and warehouse=%s and serial_no like %s - order by name desc limit 1""", - (serial_bean.doc.item_code, serial_bean.doc.warehouse, "%%%s%%" % serial_no)) + for sr in serial_nos: + serial_no = sr.strip() + if serial_no: + serial_bean = webnotes.bean("Serial No", serial_no) + if serial_bean.doc.status == "Not Available": + latest_sle = webnotes.conn.sql("""select voucher_no from `tabStock Ledger Entry` + where item_code=%s and warehouse=%s and serial_no like %s + order by name desc limit 1""", (serial_bean.doc.item_code, + serial_bean.doc.warehouse, "%%%s%%" % serial_no)) - if latest_sle and latest_sle[0][0] == d.name: - serial_bean.doc.status = "Available" - serial_bean.save() \ No newline at end of file + if latest_sle and latest_sle[0][0] == d.name: + serial_bean.doc.status = "Available" + serial_bean.save() \ No newline at end of file