def make_amendable(self):
		if self.is_submittable:
			if not frappe.db.sql("""select name from tabDocField
				where fieldname = 'amended_from' and parent = %s""", self.name):
					self.append("fields", {
						"label": "Amended From",
						"fieldtype": "Link",
						"fieldname": "amended_from",
						"options": self.name,
						"read_only": 1,
						"print_hide": 1,
						"no_copy": 1
					})
If is_submittable is set, add amended_from docfields.
dataset/ETHPy150Open frappe/frappe/frappe/core/doctype/doctype/doctype.py/DocType.make_amendable