[fix] Patch (#11976)

diff --git a/erpnext/patches/v8_10/change_default_customer_credit_days.py b/erpnext/patches/v8_10/change_default_customer_credit_days.py
index d2bc3ec..640c8aa 100644
--- a/erpnext/patches/v8_10/change_default_customer_credit_days.py
+++ b/erpnext/patches/v8_10/change_default_customer_credit_days.py
@@ -34,8 +34,8 @@
 			else:
 				template = frappe.get_doc("Payment Terms Template", pyt_template_name)
 
-			payment_terms.append('WHEN `name`="%s" THEN "%s"' % (party_name, template.template_name))
-			records.append(party_name)
+			payment_terms.append('WHEN `name`="%s" THEN "%s"' % (frappe.db.escape(party_name), template.template_name))
+			records.append(frappe.db.escape(party_name))
 
 		begin_query_str = "UPDATE `tab{0}` SET `payment_terms` = CASE ".format(doctype)
 		value_query_str = " ".join(payment_terms)