don't change lead if assigned
diff --git a/erpnext/crm/doctype/appointment/appointment.py b/erpnext/crm/doctype/appointment/appointment.py
index 5ca124b..780e04c 100644
--- a/erpnext/crm/doctype/appointment/appointment.py
+++ b/erpnext/crm/doctype/appointment/appointment.py
@@ -31,7 +31,8 @@
if(number_of_appointments_in_same_slot >= number_of_agents):
frappe.throw('Time slot is not available')
# Link lead
- self.lead = self.find_lead_by_email()
+ if not self.lead:
+ self.lead = self.find_lead_by_email()
def after_insert(self):
if self.lead:
@@ -56,8 +57,9 @@
template=template,
args=args,
subject=_('Appointment Confirmation'))
- frappe.msgprint(
- 'Please check your email to confirm the appointment')
+ if frappe.session.user == "Guest":
+ frappe.msgprint(
+ 'Please check your email to confirm the appointment')
def on_change(self):
# Sync Calendar