Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 9f37fbb..645fc69 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
 import frappe
 from erpnext.hooks import regional_overrides
 
-__version__ = '8.5.1'
+__version__ = '8.5.2'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index a11f3ac..c8a0507 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -339,7 +339,7 @@
 	'''Cache past year monthly sales of every company based on sales invoices'''
 	from frappe.utils.goal import get_monthly_results
 	import json
-	filter_str = 'company = "'+ company +'" and status != "Draft"'
+	filter_str = "company = '{0}' and status != 'Draft'".format(frappe.db.escape(company))
 	month_to_value_dict = get_monthly_results("Sales Invoice", "grand_total", "posting_date", filter_str, "sum")
 
 	frappe.db.sql(('''
diff --git a/erpnext/setup/setup_wizard/domainify.py b/erpnext/setup/setup_wizard/domainify.py
index 90878af..7f333cc 100644
--- a/erpnext/setup/setup_wizard/domainify.py
+++ b/erpnext/setup/setup_wizard/domainify.py
@@ -157,8 +157,8 @@
 	lang = frappe.db.get_single_value("System Settings", "language") or "en"
 	for module, domain in module_def_restrict_to_domain_mapper.iteritems():
 		if frappe.db.exists("Domain", _(domain, lang)):
-			frappe.set_value("Module Def", module, "restrict_to_domain", _(domain, lang))
+			frappe.db.set_value("Module Def", module, "restrict_to_domain", _(domain, lang))
 		elif frappe.db.exists("Domain", domain):
-			frappe.set_value("Module Def", module, "restrict_to_domain", domain)
+			frappe.db.set_value("Module Def", module, "restrict_to_domain", domain)
 		else:
 			pass