mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 00:44:45 +00:00
fix: Set Contact or Lead for call log
- Set contact or lead to call log on new Contact or Lead creation
This commit is contained in:
@@ -61,4 +61,26 @@ def get_employees_with_number(number):
|
||||
employee_emails = [employee.user_id for employee in employees]
|
||||
frappe.cache().hset('employees_with_number', number, employee_emails)
|
||||
|
||||
return employee
|
||||
return employee
|
||||
|
||||
def set_caller_information(doc, state):
|
||||
'''Called from hoooks on creation of Lead or Contact'''
|
||||
if doc.doctype not in ['Lead', 'Contact']: return
|
||||
|
||||
numbers = [doc.get('phone'), doc.get('mobile_no')]
|
||||
for_doc = doc.doctype.lower()
|
||||
|
||||
for number in numbers:
|
||||
if not number: continue
|
||||
print(number)
|
||||
filters = frappe._dict({
|
||||
'from': ['like', '%{}'.format(number.lstrip('0'))],
|
||||
for_doc: ''
|
||||
})
|
||||
|
||||
logs = frappe.get_all('Call Log', filters=filters)
|
||||
|
||||
for log in logs:
|
||||
call_log = frappe.get_doc('Call Log', log.name)
|
||||
call_log.set(for_doc, doc.name)
|
||||
call_log.save(ignore_permissions=True)
|
||||
|
||||
Reference in New Issue
Block a user