From a36065931d13db59b5210876fff91e6826c32480 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 30 Jun 2026 12:17:39 +0530 Subject: [PATCH] fix(telephony): scope link_existing_conversations rollback to a savepoint (review) link_existing_conversations is the Contact after_insert hook; a full frappe.db.rollback() on a failed call_log.save() would discard the triggering Contact insert itself (and, in test mode, the whole unit of work). Savepoint the hook's DB work and roll back only to it. --- erpnext/telephony/doctype/call_log/call_log.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/telephony/doctype/call_log/call_log.py b/erpnext/telephony/doctype/call_log/call_log.py index 2a6660c101f..c932eb515db 100644 --- a/erpnext/telephony/doctype/call_log/call_log.py +++ b/erpnext/telephony/doctype/call_log/call_log.py @@ -163,6 +163,7 @@ def link_existing_conversations(doc, state): return if doc.doctype != "Contact": return + frappe.db.savepoint("link_call_logs") try: numbers = [d.phone for d in doc.phone_nos] @@ -196,7 +197,7 @@ def link_existing_conversations(doc, state): if not frappe.in_test: frappe.db.commit() except Exception: - frappe.db.rollback() + frappe.db.rollback(save_point="link_call_logs") frappe.log_error(title=_("Error during caller information update"))