[fix] customer naming series validation and patch to fix missing default taxes and lead
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 98c6f45..e20aab0 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -208,3 +208,4 @@
 erpnext.patches.v6_0.fix_planned_qty
 erpnext.patches.v6_0.multi_currency
 erpnext.patches.v6_2.remove_newsletter_duplicates
+erpnext.patches.v6_2.fix_missing_default_taxes_and_lead
diff --git a/erpnext/patches/v6_2/fix_missing_default_taxes_and_lead.py b/erpnext/patches/v6_2/fix_missing_default_taxes_and_lead.py
new file mode 100644
index 0000000..9c16f63
--- /dev/null
+++ b/erpnext/patches/v6_2/fix_missing_default_taxes_and_lead.py
@@ -0,0 +1,25 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	# remove missing default taxes
+	for customer in frappe.db.sql_list("""select name from `tabCustomer`
+		where ifnull(default_taxes_and_charges, '')!='' and not exists (
+			select name from `tabSales Taxes and Charges Template` where name=`tabCustomer`.default_taxes_and_charges
+		)"""):
+		c = frappe.get_doc("Customer", customer)
+		c.default_taxes_and_charges = None
+		c.save()
+
+	for supplier in frappe.db.sql_list("""select name from `tabSupplier`
+		where ifnull(default_taxes_and_charges, '')!='' and not exists (
+			select name from `tabPurchase Taxes and Charges Template` where name=`tabSupplier`.default_taxes_and_charges
+		)"""):
+		c = frappe.get_doc("Supplier", supplier)
+		c.default_taxes_and_charges = None
+		c.save()
+
+	# remove missing lead
+	for customer in frappe.db.sql_list("""select name from `tabCustomer`
+		where ifnull(lead_name, '')!='' and not exists (select name from `tabLead` where name=`tabCustomer`.lead_name)"""):
+		frappe.db.set_value("Customer", customer, "lead_name", None)
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 7fe1459..b060fba 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -26,15 +26,13 @@
 		if cust_master_name == 'Customer Name':
 			self.name = self.customer_name
 		else:
-			self.name = make_autoname(self.naming_series+'.#####')
+			if not self.naming_series:
+				frappe.throw(_("Series is mandatory"), frappe.MandatoryError)
 
-	def validate_mandatory(self):
-		if frappe.defaults.get_global_default('cust_master_name') == 'Naming Series' and not self.naming_series:
-			frappe.throw(_("Series is mandatory"), frappe.MandatoryError)
+			self.name = make_autoname(self.naming_series+'.#####')
 
 	def validate(self):
 		self.flags.is_new_doc = self.is_new()
-		self.validate_mandatory()
 		validate_accounting_currency(self)
 		validate_party_account(self)