Esempio n. 1
0
 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)
     if self.contact:
         contact = frappe.get_doc("Contact", self.contact)
         self.customer = contact.get_link_for("Customer")
Esempio n. 2
0
def get_contact_details(phone):
    """Get information about existing contact in the system.
	"""
    contact = get_contact_with_phone_number(phone.strip())
    if not contact: return
    contact_doc = frappe.get_doc('Contact', contact)
    return contact_doc and {
        'first_name': contact_doc.first_name.title(),
        'email_id': contact_doc.email_id,
        'phone_number': contact_doc.phone
    }
Esempio n. 3
0
	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)
Esempio n. 4
0
	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()
Esempio n. 5
0
	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)
Esempio n. 6
0
 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)