mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-15 18:01:41 +00:00
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:
@@ -197,17 +197,17 @@ class Lead(SellingController, CRMNote):
|
|||||||
lead_row.db_update()
|
lead_row.db_update()
|
||||||
|
|
||||||
def remove_link_from_prospect(self):
|
def remove_link_from_prospect(self):
|
||||||
prospects = self.get_linked_prospects()
|
linked_prospects = self.get_linked_prospects()
|
||||||
|
|
||||||
for d in prospects:
|
for linked_prospect in linked_prospects:
|
||||||
prospect = frappe.get_doc("Prospect", d.parent)
|
prospect = frappe.get_doc("Prospect", linked_prospect.parent)
|
||||||
if len(prospect.get("leads")) == 1:
|
if len(prospect.get("leads")) == 1:
|
||||||
prospect.delete(ignore_permissions=True)
|
prospect.delete(ignore_permissions=True)
|
||||||
else:
|
else:
|
||||||
to_remove = None
|
to_remove = None
|
||||||
for d in prospect.get("leads"):
|
for lead in prospect.get("leads"):
|
||||||
if d.lead == self.name:
|
if lead.lead == self.name:
|
||||||
to_remove = d
|
to_remove = lead
|
||||||
|
|
||||||
if to_remove:
|
if to_remove:
|
||||||
prospect.remove(to_remove)
|
prospect.remove(to_remove)
|
||||||
|
|||||||
Reference in New Issue
Block a user