ifsql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button'")[0][0]>1:
sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button' limit 1")
sql("delete from `tabModule Def Item` where display_name = 'Serial No' and parent = 'Support'")
sql("update `tabDocType` set subject = 'Item Code: %(item_code)s, Warehouse: %(warehouse)s' where name = 'Serial No'")
# Patch for adding packing related columns (packed by, checked by, shipping mark etc)
reload_doc('stock','doctype','delivery_note')
sql("update `tabDocField` set allow_on_submit = 1 where fieldname = 'page_break'")
sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('indent_details', 'po_details', 'purchase_receipt_details', 'entries', 'sales_order_details', 'delivery_note_details', 'quotation_details') and fieldtype = 'Table'")