[fixes] set lead to Null on delete company transaction & other minor fixes
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index a454833..e14cde0 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -95,11 +95,11 @@
 	def create_lead_address_contact(self):
 		if self.lead_name:
 			# assign lead address to customer (if already not set)
-			address_names = frappe.db.get_values('Dynamic Link', dict(
-								parenttype='Address',
-								link_doctype='Lead',
-								link_name=self.lead_name
-							), 'parent as name', as_dict=True)
+			address_names = frappe.get_all('Dynamic Link', filters={
+								"parenttype":"Address",
+								"link_doctype":"Lead",
+								"link_name":self.lead_name
+							}, fields=["parent as name"])
 
 			for address_name in address_names:
 				address = frappe.get_doc('Address', address_name.get('name'))
diff --git a/erpnext/setup/doctype/company/delete_company_transactions.py b/erpnext/setup/doctype/company/delete_company_transactions.py
index 1aca24c..eef8599 100644
--- a/erpnext/setup/doctype/company/delete_company_transactions.py
+++ b/erpnext/setup/doctype/company/delete_company_transactions.py
@@ -89,7 +89,7 @@
 		frappe.db.sql("""delete from `tabDynamic Link` where link_doctype='Lead' and parenttype='Address' 
 			and link_name in ({leads})""".format(leads=",".join(leads)), debug=True)
 
-		frappe.db.sql("""update tabCustomer set lead_name='' where lead_name in ({leads})""".format(leads=",".join(leads)), debug=True)
+		frappe.db.sql("""update tabCustomer set lead_name=NULL where lead_name in ({leads})""".format(leads=",".join(leads)), debug=True)
 
 def delete_communications(doctype, company_name, company_fieldname):
 		frappe.db.sql("""