From b6b27d9256be2c3d72522c6baf647fcac1fd0bfd Mon Sep 17 00:00:00 2001 From: Pranav Nachanekar Date: Mon, 23 Sep 2019 14:16:13 +0530 Subject: [PATCH] Corrected moving to doctype for email --- erpnext/crm/doctype/appointment/appointment.py | 12 ++++++------ erpnext/www/book-appointment/index.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/crm/doctype/appointment/appointment.py b/erpnext/crm/doctype/appointment/appointment.py index 1095b56ae9..219f93111a 100644 --- a/erpnext/crm/doctype/appointment/appointment.py +++ b/erpnext/crm/doctype/appointment/appointment.py @@ -8,6 +8,7 @@ from collections import Counter from datetime import timedelta import frappe +from frappe import _ from frappe.model.document import Document from frappe.desk.form.assign_to import add as add_assignemnt @@ -15,10 +16,9 @@ from frappe.desk.form.assign_to import add as add_assignemnt class Appointment(Document): def find_lead_by_email(self): - lead_list = frappe.get_list('Lead', filters = {'email_id':self.email}, ignore_permissions = True) + lead_list = frappe.get_list('Lead', filters = {'email_id':self.customer_email}, ignore_permissions = True) if lead_list: return lead_list[0].name - self.email = email return None def before_insert(self): @@ -40,9 +40,9 @@ class Appointment(Document): # Set status to unverified self.status = 'Unverified' # Send email to confirm - verify_url = ''.join([frappe.utils.get_url(),'/book-appointment/verify?email=',self.email,'&appoitnment=',self.name]) - message = ''.join(['Please click the following link to confirm your appointment:']+verify_url) - frappe.sendmail(recipients=[self.email], + verify_url = ''.join([frappe.utils.get_url(),'/book-appointment/verify?email=',self.customer_email,'&appoitnment=',self.name]) + message = ''.join(['Please click the following link to confirm your appointment:',verify_url]) + frappe.sendmail(recipients=[self.customer_email], message=message, subject=_('Appointment Confirmation')) frappe.msgprint('Please check your email to confirm the appointment') @@ -54,7 +54,7 @@ class Appointment(Document): cal_event.save() def set_verified(self,email): - if not email == self.email: + if not email == self.customer_email: frappe.throw('Email verification failed.') # Create new lead self.create_lead() diff --git a/erpnext/www/book-appointment/index.py b/erpnext/www/book-appointment/index.py index 67619fc5d5..49b3ffc2cf 100644 --- a/erpnext/www/book-appointment/index.py +++ b/erpnext/www/book-appointment/index.py @@ -98,7 +98,7 @@ def create_appointment(date, time, contact): appointment.customer_phone_number = contact['number'] appointment.customer_skype = contact['skype'] appointment.customer_details = contact['notes'] - appointment.email = contact['email'] + appointment.customer_email = contact['email'] appointment.status = 'Open' appointment.insert()