Update lead.py (#8789)
* Update lead.py
Import datetime to compare next contact date with now()
* Update lead.py
* Update lead.py
As per the suggestion from Nabin,instead of Datetime,getdate and nowdate from frappe.utils imported
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index e6659f3..a37caea 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
-from frappe.utils import (cstr, validate_email_add, cint, comma_and, has_gravatar, now)
+from frappe.utils import (cstr, validate_email_add, cint, comma_and, has_gravatar, now, getdate, nowdate)
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.selling_controller import SellingController
@@ -45,7 +45,7 @@
self.image = has_gravatar(self.email_id)
- if self.contact_date and self.contact_date < now():
+ if self.contact_date and getdate(self.contact_date) < getdate(nowdate()):
frappe.throw(_("Next Contact Date cannot be in the past"))
def on_update(self):