import xhiveframework


def execute():

	doctype = "Stock Reconciliation Item"

	if not xhiveframework.db.has_column(doctype, "current_serial_no"):
		# nothing to fix if column doesn't exist
		return

	sr_item = xhiveframework.qb.DocType(doctype)

	(
		xhiveframework.qb.update(sr_item).set(sr_item.current_serial_no, None).where(sr_item.current_qty == 0)
	).run()
