brotherton-erpnext/patches/november_2012/cancelled_bom_patch.py

14 lines
362 B
Python
Raw Normal View History

2012-11-27 13:25:17 +00:00
import webnotes
def execute():
cancelled_boms = webnotes.conn.sql("""select name from `tabBOM`
where docstatus = 2""")
for bom in cancelled_boms:
2012-12-14 08:55:51 +00:00
webnotes.conn.sql("""update `tabBOM` set is_default=0, is_active=0
2012-11-27 13:25:17 +00:00
where name=%s""", (bom[0],))
webnotes.conn.sql("""update `tabItem` set default_bom=null
where default_bom=%s""", (bom[0],))