make quotation button added to lead

This commit is contained in:
Neil Trini Lasrado 2015-03-20 16:03:11 +05:30
parent aca5c7b580
commit bef6fa152e
2 changed files with 23 additions and 0 deletions

View File

@ -31,6 +31,8 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
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 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
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
})
}
});

View File

@ -125,6 +125,20 @@ def make_opportunity(source_name, target_doc=None):
}}, 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):