Skip to content

Commit

Permalink
Merge pull request #42119 from ruthra-kumar/ui_typerror_on_lead
Browse files Browse the repository at this point in the history
fix: broken button under `Actions` in Lead doctype
  • Loading branch information
ruthra-kumar authored Jul 1, 2024
2 parents 55a4bd4 + f440e7c commit 7c9129d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions erpnext/crm/doctype/lead/lead.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
this.frm.add_custom_button(__("Quotation"), this.make_quotation.bind(this), __("Create"));
if (!doc.__onload.linked_prospects.length) {
this.frm.add_custom_button(__("Prospect"), this.make_prospect.bind(this), __("Create"));
this.frm.add_custom_button(__("Add to Prospect"), this.add_lead_to_prospect, __("Action"));
this.frm.add_custom_button(
__("Add to Prospect"),
() => {
this.add_lead_to_prospect(this.frm);
},
__("Action")
);
}
}

Expand All @@ -47,8 +53,7 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
this.show_activities();
}

add_lead_to_prospect() {
let me = this;
add_lead_to_prospect(frm) {
frappe.prompt(
[
{
Expand All @@ -63,12 +68,12 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
frappe.call({
method: "erpnext.crm.doctype.lead.lead.add_lead_to_prospect",
args: {
lead: me.frm.doc.name,
lead: frm.doc.name,
prospect: data.prospect,
},
callback: function (r) {
if (!r.exc) {
me.frm.reload_doc();
frm.reload_doc();
}
},
freeze: true,
Expand Down

0 comments on commit 7c9129d

Please sign in to comment.