From 43d2c7335de9392cd28f69bd73da2a05d9b41ef1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Jun 2026 13:10:29 +0530 Subject: [PATCH] refactor(lead): name the loops in remove_link_from_prospect The outer and inner loops both used 'd'; name them linked_prospect and lead so the prospect/lead iteration reads clearly. No behaviour change. --- erpnext/crm/doctype/lead/lead.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index 6e2e6a57bb1..5757d20c824 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -197,17 +197,17 @@ class Lead(SellingController, CRMNote): lead_row.db_update() def remove_link_from_prospect(self): - prospects = self.get_linked_prospects() + linked_prospects = self.get_linked_prospects() - for d in prospects: - prospect = frappe.get_doc("Prospect", d.parent) + for linked_prospect in linked_prospects: + prospect = frappe.get_doc("Prospect", linked_prospect.parent) if len(prospect.get("leads")) == 1: prospect.delete(ignore_permissions=True) else: to_remove = None - for d in prospect.get("leads"): - if d.lead == self.name: - to_remove = d + for lead in prospect.get("leads"): + if lead.lead == self.name: + to_remove = lead if to_remove: prospect.remove(to_remove)