[minor] try block in serial no status patch

This commit is contained in:
Nabin Hait 2013-10-24 17:30:20 +05:30
parent 101a097e44
commit e36edc14f6

View File

@ -9,10 +9,13 @@ def execute():
serial_nos = webnotes.conn.sql("""select name from `tabSerial No` where status!='Not in Use'
and docstatus=0""")
for sr in serial_nos:
sr_bean = webnotes.bean("Serial No", sr[0])
sr_bean.make_controller().via_stock_ledger = True
sr_bean.run_method("validate")
sr_bean.save()
try:
sr_bean = webnotes.bean("Serial No", sr[0])
sr_bean.make_controller().via_stock_ledger = True
sr_bean.run_method("validate")
sr_bean.save()
except:
pass
webnotes.conn.sql("""update `tabSerial No` set warehouse='' where status in
('Delivered', 'Purchase Returned')""")