From 1f4702bde7b2bdee2b4f5529af9644e90ceff6ec Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 18 Jun 2026 21:04:33 +0530 Subject: [PATCH] fix(crm): skip rows with no first-contact date in lead conversion time Address review (#56105): when there's no matching communication, first_contact is None and date_diff(invoice_date, None) treats None as today, giving a wrong (negative) duration. Skip the entry instead, mirroring the communication_count guard. Co-Authored-By: Claude Opus 4.8 (1M context) --- erpnext/crm/report/lead_conversion_time/lead_conversion_time.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py b/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py index c16ea672f62..f11b54a0be6 100644 --- a/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py +++ b/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py @@ -132,6 +132,8 @@ def get_communication_details(filters): (d.contact_email), ) first_contact = first_contact[0][0] if first_contact else None + if not first_contact: + continue duration = flt(date_diff(invoice[0][0], first_contact))