make quotation button added to lead
diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js
index 25ddf73..e9b07fe 100644
--- a/erpnext/crm/doctype/lead/lead.js
+++ b/erpnext/crm/doctype/lead/lead.js
@@ -31,6 +31,8 @@
frappe.boot.doctype_icons["Customer"], "btn-default");
this.frm.add_custom_button(__("Create Opportunity"), this.create_opportunity,
frappe.boot.doctype_icons["Opportunity"], "btn-default");
+ this.frm.add_custom_button(__("Make Quotation"), this.make_quotation,
+ frappe.boot.doctype_icons["Quotation"], "btn-default");
}
if(!this.frm.doc.__islocal) {
@@ -50,6 +52,13 @@
method: "erpnext.crm.doctype.lead.lead.make_opportunity",
frm: cur_frm
})
+ },
+
+ make_quotation: function() {
+ frappe.model.open_mapped_doc({
+ method: "erpnext.crm.doctype.lead.lead.make_quotation",
+ frm: cur_frm
+ })
}
});
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index f19a969..f0b48b4 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -125,6 +125,20 @@
}}, target_doc)
return target_doc
+
+@frappe.whitelist()
+def make_quotation(source_name, target_doc=None):
+ target_doc = get_mapped_doc("Lead", source_name,
+ {"Lead": {
+ "doctype": "Quotation",
+ "field_map": {
+ "name": "lead",
+ "lead_name": "customer_name",
+ }
+ }}, target_doc)
+ target_doc.quotation_to = "Lead"
+
+ return target_doc
@frappe.whitelist()
def get_lead_details(lead):