Update crm/fcrm/doctype/crm_lead/crm_lead.py

Co-authored-by: Shariq Ansari <30859809+shariquerik@users.noreply.github.com>
This commit is contained in:
Muhammed Raihan P A 2024-10-21 08:55:20 -08:00 committed by GitHub
parent ef41bc076c
commit 0d25867aec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,11 +21,9 @@ class CRMLead(Document):
self.set_lead_name()
self.set_title()
self.validate_email()
if not self.is_new():
curr_owner = frappe.db.get_value(self.doctype,self.name,"lead_owner")
if self.lead_owner and self.lead_owner != curr_owner:
self.share_with_agent(self.lead_owner)
self.assign_agent(self.lead_owner)
if not self.is_new() and self.has_value_changed("lead_owner") and self.lead_owner:
self.share_with_agent(self.lead_owner)
self.assign_agent(self.lead_owner)
if self.has_value_changed("status"):
add_status_change_log(self)