def before_insert(self): number = strip_number(self.get('from')) self.contact = get_contact_with_phone_number(number) self.lead = get_lead_with_phone_number(number) contact = frappe.get_doc("Contact", self.contact) self.customer = contact.get_link_for("Customer")
def before_insert(self): """Add lead(third party person) links to the document. """ lead_number = self.get('from') if self.is_incoming_call() else self.get('to') lead_number = strip_number(lead_number) contact = get_contact_with_phone_number(strip_number(lead_number)) if contact: self.add_link(link_type='Contact', link_name=contact) lead = get_lead_with_phone_number(lead_number) if lead: self.add_link(link_type='Lead', link_name=lead)
def before_insert(self): """Add lead(third party person) links to the document.""" lead_number = self.get("from") if self.is_incoming_call() else self.get("to") lead_number = strip_number(lead_number) contact = get_contact_with_phone_number(strip_number(lead_number)) if contact: self.add_link(link_type="Contact", link_name=contact) lead = get_lead_with_phone_number(lead_number) if lead: self.add_link(link_type="Lead", link_name=lead) # Add Employee Name if self.is_incoming_call(): self.update_received_by()
def before_insert(self): number = strip_number(self.get('from')) self.contact = get_contact_with_phone_number(number) self.lead = get_lead_with_phone_number(number)
def before_insert(self): # strip 0 from the start of the number for proper number comparisions # eg. 07888383332 should match with 7888383332 number = self.get('from').lstrip('0') self.contact = get_contact_with_phone_number(number) self.lead = get_lead_with_phone_number(number)