From 59b49120b782e6b3f59116bcb4c873ddb66d9a40 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 1 Jul 2026 12:28:36 +0530 Subject: [PATCH] fix(crm): keep returning None from create_customer on a linking failure Preserve the pre-existing contract: create_customer returned None when contact/address linking failed. The savepoint fix kept the Customer (good) but started returning its name in that case, so a CRM caller treating a non-None return as full success could skip its retry/error handling. Return None on a linking failure while still keeping the Customer. (greptile #56683) Co-Authored-By: Claude Opus 4.8 --- erpnext/crm/frappe_crm_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/crm/frappe_crm_api.py b/erpnext/crm/frappe_crm_api.py index ca7dc56b556..bbb0b8e5215 100644 --- a/erpnext/crm/frappe_crm_api.py +++ b/erpnext/crm/frappe_crm_api.py @@ -169,6 +169,9 @@ def create_customer(customer_data: dict | None = None): except Exception: frappe.db.rollback(save_point="crm_customer_links") frappe.log_error(frappe.get_traceback(), "Error while linking contacts/address to new Customer") + # keep the Customer, but preserve the pre-existing contract of returning None on a linking failure + # so CRM callers still see the failure signal + return return customer_name