From fce8f36bb2ba3541895a67714ec508b45e48d487 Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Thu, 7 Nov 2019 12:37:28 +0530 Subject: [PATCH] don't change lead if assigned --- erpnext/crm/doctype/appointment/appointment.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/crm/doctype/appointment/appointment.py b/erpnext/crm/doctype/appointment/appointment.py index 5ca124bd853..780e04c5ae1 100644 --- a/erpnext/crm/doctype/appointment/appointment.py +++ b/erpnext/crm/doctype/appointment/appointment.py @@ -31,7 +31,8 @@ class Appointment(Document): 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 @@ class Appointment(Document): 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