mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
Merge pull request #45300 from HarryPaulo/fix-prevent-commit
fix: prevent unnecessary db.commit for contact insert
This commit is contained in:
@@ -157,6 +157,8 @@ def link_existing_conversations(doc, state):
|
|||||||
"""
|
"""
|
||||||
Called from hooks on creation of Contact or Lead to link all the existing conversations.
|
Called from hooks on creation of Contact or Lead to link all the existing conversations.
|
||||||
"""
|
"""
|
||||||
|
if doc.flags.ignore_auto_link_call_log:
|
||||||
|
return
|
||||||
if doc.doctype != "Contact":
|
if doc.doctype != "Contact":
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
@@ -183,12 +185,12 @@ def link_existing_conversations(doc, state):
|
|||||||
""",
|
""",
|
||||||
dict(phone_number=f"%{number}", docname=doc.name, doctype=doc.doctype),
|
dict(phone_number=f"%{number}", docname=doc.name, doctype=doc.doctype),
|
||||||
)
|
)
|
||||||
|
if logs:
|
||||||
for log in logs:
|
for log in logs:
|
||||||
call_log = frappe.get_doc("Call Log", log)
|
call_log = frappe.get_doc("Call Log", log)
|
||||||
call_log.add_link(link_type=doc.doctype, link_name=doc.name)
|
call_log.add_link(link_type=doc.doctype, link_name=doc.name)
|
||||||
call_log.save(ignore_permissions=True)
|
call_log.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
except Exception:
|
except Exception:
|
||||||
frappe.log_error(title=_("Error during caller information update"))
|
frappe.log_error(title=_("Error during caller information update"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user