Merge pull request #38647 from barredterra/copy-emails-to-customer
This commit is contained in:
commit
617d923f0d
@ -230,6 +230,7 @@ class Customer(TransactionBase):
|
|||||||
|
|
||||||
if self.flags.is_new_doc:
|
if self.flags.is_new_doc:
|
||||||
self.link_lead_address_and_contact()
|
self.link_lead_address_and_contact()
|
||||||
|
self.copy_communication()
|
||||||
|
|
||||||
self.update_customer_groups()
|
self.update_customer_groups()
|
||||||
|
|
||||||
@ -291,6 +292,17 @@ class Customer(TransactionBase):
|
|||||||
linked_doc.append("links", dict(link_doctype="Customer", link_name=self.name))
|
linked_doc.append("links", dict(link_doctype="Customer", link_name=self.name))
|
||||||
linked_doc.save(ignore_permissions=self.flags.ignore_permissions)
|
linked_doc.save(ignore_permissions=self.flags.ignore_permissions)
|
||||||
|
|
||||||
|
def copy_communication(self):
|
||||||
|
if not self.lead_name or not frappe.db.get_single_value(
|
||||||
|
"CRM Settings", "carry_forward_communication_and_comments"
|
||||||
|
):
|
||||||
|
return
|
||||||
|
|
||||||
|
from erpnext.crm.utils import copy_comments, link_communications
|
||||||
|
|
||||||
|
copy_comments("Lead", self.lead_name, self)
|
||||||
|
link_communications("Lead", self.lead_name, self)
|
||||||
|
|
||||||
def validate_name_with_customer_group(self):
|
def validate_name_with_customer_group(self):
|
||||||
if frappe.db.exists("Customer Group", self.name):
|
if frappe.db.exists("Customer Group", self.name):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user