@frappe.whitelist()
def cancel(doctype=None, name=None, workflow_state_fieldname=None, workflow_state=None):
	try:
		doc = frappe.get_doc(doctype, name)
		if workflow_state_fieldname and workflow_state:
			doc.set(workflow_state_fieldname, workflow_state)
		doc.cancel()
		send_updated_docs(doc)

	except Exception:
		frappe.errprint(frappe.utils.get_traceback())
		frappe.msgprint(frappe._("Did not cancel"))
		raise
cancel a doclist
dataset/ETHPy150Open frappe/frappe/frappe/desk/form/save.py/cancel