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.
This commit is contained in:
Nabin Hait
2026-06-22 13:10:29 +05:30
parent 8f69697212
commit 43d2c7335d

View File

@@ -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)