Skip to content

Commit

Permalink
fix: enabling lead even after "Opportunity" created against it (#34627)
Browse files Browse the repository at this point in the history
* fix: enabling lead even after "Opportunity" created against it

* chore: Linting Issues

---------

Co-authored-by: Komal Saraf <komal@frappe.io>
Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
  • Loading branch information
3 people authored Mar 30, 2023
1 parent 7c5720d commit ad11934
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 0 additions & 5 deletions erpnext/crm/doctype/opportunity/opportunity.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def onload(self):
def after_insert(self):
if self.opportunity_from == "Lead":
frappe.get_doc("Lead", self.party_name).set_status(update=True)
self.disable_lead()

link_open_tasks(self.opportunity_from, self.party_name, self)
link_open_events(self.opportunity_from, self.party_name, self)
Expand Down Expand Up @@ -119,10 +118,6 @@ def update_prospect(self):
prospect.flags.ignore_mandatory = True
prospect.save()

def disable_lead(self):
if self.opportunity_from == "Lead":
frappe.db.set_value("Lead", self.party_name, {"disabled": 1, "docstatus": 1})

def make_new_lead_if_required(self):
"""Set lead against new opportunity"""
if (not self.get("party_name")) and self.contact_email:
Expand Down
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,4 @@ erpnext.patches.v14_0.update_closing_balances
# below migration patches should always run last
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
execute:frappe.delete_doc_if_exists("Report", "Tax Detail")
erpnext.patches.v15_0.enable_all_leads
8 changes: 8 additions & 0 deletions erpnext/patches/v15_0/enable_all_leads.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import frappe


def execute():
lead = frappe.qb.DocType("Lead")
frappe.qb.update(lead).set(lead.disabled, 0).set(lead.docstatus, 0).where(
lead.disabled == 1 and lead.docstatus == 1
).run()

0 comments on commit ad11934

Please sign in to comment.