fix: clear demo data with unknown columns (#36637)

diff --git a/erpnext/setup/demo.py b/erpnext/setup/demo.py
index 1c19974..a6df419 100644
--- a/erpnext/setup/demo.py
+++ b/erpnext/setup/demo.py
@@ -180,8 +180,16 @@
 def clear_demo_record(document):
 	document_type = document.get("doctype")
 	del document["doctype"]
-	doc = frappe.get_doc(document_type, document)
-	frappe.delete_doc(doc.doctype, doc.name, ignore_permissions=True)
+
+	valid_columns = frappe.get_meta(document_type).get_valid_columns()
+
+	filters = document
+	for key in list(filters):
+		if key not in valid_columns:
+			filters.pop(key, None)
+
+	doc = frappe.get_doc(document_type, filters)
+	doc.delete(ignore_permissions=True)
 
 
 def delete_company(company):