Merge pull request #5952 from nabinhait/lcv_reference

[patch] Update refdoc in Landed Cost Voucher
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index 7978882..0f4d1f4 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -3,7 +3,7 @@
 
 from __future__ import unicode_literals
 import frappe, json
-from frappe.utils import cstr, cint, get_fullname
+from frappe.utils import cstr, cint, get_fullname, validate_email_add
 from frappe import msgprint, _
 from frappe.model.mapper import get_mapped_doc
 from erpnext.setup.utils import get_exchange_rate
@@ -43,7 +43,7 @@
 
 	def make_new_lead_if_required(self):
 		"""Set lead against new opportunity"""
-		if not (self.lead or self.customer) and self.contact_email:
+		if not (self.lead or self.customer) and self.contact_email and validate_email_add(self.contact_email):
 			lead_name = frappe.db.get_value("Lead", {"email_id": self.contact_email})
 			if not lead_name:
 				sender_name = get_fullname(self.contact_email)
@@ -63,6 +63,7 @@
 					"email_id": self.contact_email,
 					"lead_name": sender_name
 				})
+
 				lead.insert(ignore_permissions=True)
 				lead_name = lead.name
 
diff --git a/erpnext/patches/v6_20x/remove_customer_supplier_roles.py b/erpnext/patches/v6_20x/remove_customer_supplier_roles.py
index e5e3d3f..f4167bf 100644
--- a/erpnext/patches/v6_20x/remove_customer_supplier_roles.py
+++ b/erpnext/patches/v6_20x/remove_customer_supplier_roles.py
@@ -2,6 +2,10 @@
 import frappe
 
 def execute():
+	frappe.reload_doc("buying", "doctype", "request_for_quotation_supplier")
+	frappe.reload_doc("buying", "doctype", "request_for_quotation")
+	frappe.reload_doc("projects", "doctype", "timesheet")
+	
 	for role in ('Customer', 'Supplier'):
 		frappe.db.sql('''delete from `tabUserRole`
 			where role=%s and parent in ("Administrator", "Guest")''', role)