Merge pull request #42119 from ruthra-kumar/ui_typerror_on_lead

fix: broken button under `Actions` in Lead doctype
This commit is contained in:
ruthra kumar
2024-07-01 13:20:07 +05:30
committed by GitHub

View File

@@ -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")); this.frm.add_custom_button(__("Quotation"), this.make_quotation.bind(this), __("Create"));
if (!doc.__onload.linked_prospects.length) { if (!doc.__onload.linked_prospects.length) {
this.frm.add_custom_button(__("Prospect"), this.make_prospect.bind(this), __("Create")); 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")
);
} }
} }
@@ -47,8 +53,7 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
this.show_activities(); this.show_activities();
} }
add_lead_to_prospect() { add_lead_to_prospect(frm) {
let me = this;
frappe.prompt( frappe.prompt(
[ [
{ {
@@ -63,12 +68,12 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
frappe.call({ frappe.call({
method: "erpnext.crm.doctype.lead.lead.add_lead_to_prospect", method: "erpnext.crm.doctype.lead.lead.add_lead_to_prospect",
args: { args: {
lead: me.frm.doc.name, lead: frm.doc.name,
prospect: data.prospect, prospect: data.prospect,
}, },
callback: function (r) { callback: function (r) {
if (!r.exc) { if (!r.exc) {
me.frm.reload_doc(); frm.reload_doc();
} }
}, },
freeze: true, freeze: true,