mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-19 10:14:59 +00:00
fix: enabling lead even after "Opportunity" created against it (#34627)
* 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>
(cherry picked from commit ad11934d39)
# Conflicts:
# erpnext/patches.txt
# erpnext/patches/v14_0/enable_all_leads.py
This commit is contained in:
@@ -33,7 +33,6 @@ class Opportunity(TransactionBase, CRMNote):
|
|||||||
def after_insert(self):
|
def after_insert(self):
|
||||||
if self.opportunity_from == "Lead":
|
if self.opportunity_from == "Lead":
|
||||||
frappe.get_doc("Lead", self.party_name).set_status(update=True)
|
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_tasks(self.opportunity_from, self.party_name, self)
|
||||||
link_open_events(self.opportunity_from, self.party_name, self)
|
link_open_events(self.opportunity_from, self.party_name, self)
|
||||||
@@ -119,10 +118,6 @@ class Opportunity(TransactionBase, CRMNote):
|
|||||||
prospect.flags.ignore_mandatory = True
|
prospect.flags.ignore_mandatory = True
|
||||||
prospect.save()
|
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):
|
def make_new_lead_if_required(self):
|
||||||
"""Set lead against new opportunity"""
|
"""Set lead against new opportunity"""
|
||||||
if (not self.get("party_name")) and self.contact_email:
|
if (not self.get("party_name")) and self.contact_email:
|
||||||
|
|||||||
@@ -328,3 +328,8 @@ erpnext.patches.v14_0.set_pick_list_status
|
|||||||
erpnext.patches.v13_0.update_docs_link
|
erpnext.patches.v13_0.update_docs_link
|
||||||
# below migration patches should always run last
|
# below migration patches should always run last
|
||||||
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
|
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
execute:frappe.delete_doc_if_exists("Report", "Tax Detail")
|
||||||
|
erpnext.patches.v15_0.enable_all_leads
|
||||||
|
>>>>>>> ad11934d39 (fix: enabling lead even after "Opportunity" created against it (#34627))
|
||||||
|
|||||||
8
erpnext/patches/v14_0/enable_all_leads.py
Normal file
8
erpnext/patches/v14_0/enable_all_leads.py
Normal file
@@ -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()
|
||||||
Reference in New Issue
Block a user