Merge pull request #28440 from anupamvs/crm-lead-validate-cleanup-develop
fix: lead validate function cleanup
This commit is contained in:
parent
c5c7777bd5
commit
66a10c0e73
@ -8,7 +8,6 @@ from frappe.contacts.address_and_contact import load_address_and_contact
|
|||||||
from frappe.email.inbox import link_communication_to_document
|
from frappe.email.inbox import link_communication_to_document
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
from frappe.utils import (
|
from frappe.utils import (
|
||||||
cint,
|
|
||||||
comma_and,
|
comma_and,
|
||||||
cstr,
|
cstr,
|
||||||
get_link_to_form,
|
get_link_to_form,
|
||||||
@ -39,11 +38,7 @@ class Lead(SellingController):
|
|||||||
self.check_email_id_is_unique()
|
self.check_email_id_is_unique()
|
||||||
self.validate_email_id()
|
self.validate_email_id()
|
||||||
self.validate_contact_date()
|
self.validate_contact_date()
|
||||||
self._prev = frappe._dict({
|
self.set_prev()
|
||||||
"contact_date": frappe.db.get_value("Lead", self.name, "contact_date") if (not cint(self.is_new())) else None,
|
|
||||||
"ends_on": frappe.db.get_value("Lead", self.name, "ends_on") if (not cint(self.is_new())) else None,
|
|
||||||
"contact_by": frappe.db.get_value("Lead", self.name, "contact_by") if (not cint(self.is_new())) else None,
|
|
||||||
})
|
|
||||||
|
|
||||||
def set_full_name(self):
|
def set_full_name(self):
|
||||||
if self.first_name:
|
if self.first_name:
|
||||||
@ -75,6 +70,16 @@ class Lead(SellingController):
|
|||||||
self.add_calendar_event()
|
self.add_calendar_event()
|
||||||
self.update_prospects()
|
self.update_prospects()
|
||||||
|
|
||||||
|
def set_prev(self):
|
||||||
|
if self.is_new():
|
||||||
|
self._prev = frappe._dict({
|
||||||
|
"contact_date": None,
|
||||||
|
"ends_on": None,
|
||||||
|
"contact_by": None
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
self._prev = frappe.db.get_value("Lead", self.name, ["contact_date", "ends_on", "contact_by"], as_dict=1)
|
||||||
|
|
||||||
def before_insert(self):
|
def before_insert(self):
|
||||||
self.contact_doc = self.create_contact()
|
self.contact_doc = self.create_contact()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user