Merge pull request #2988 from neilLasrado/make-quote
make quotation button added to lead
This commit is contained in:
commit
395724dcdb
@ -31,6 +31,8 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
|
|||||||
frappe.boot.doctype_icons["Customer"], "btn-default");
|
frappe.boot.doctype_icons["Customer"], "btn-default");
|
||||||
this.frm.add_custom_button(__("Create Opportunity"), this.create_opportunity,
|
this.frm.add_custom_button(__("Create Opportunity"), this.create_opportunity,
|
||||||
frappe.boot.doctype_icons["Opportunity"], "btn-default");
|
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) {
|
if(!this.frm.doc.__islocal) {
|
||||||
@ -50,6 +52,13 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
|
|||||||
method: "erpnext.crm.doctype.lead.lead.make_opportunity",
|
method: "erpnext.crm.doctype.lead.lead.make_opportunity",
|
||||||
frm: cur_frm
|
frm: cur_frm
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
make_quotation: function() {
|
||||||
|
frappe.model.open_mapped_doc({
|
||||||
|
method: "erpnext.crm.doctype.lead.lead.make_quotation",
|
||||||
|
frm: cur_frm
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -125,6 +125,20 @@ def make_opportunity(source_name, target_doc=None):
|
|||||||
}}, target_doc)
|
}}, target_doc)
|
||||||
|
|
||||||
return 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()
|
@frappe.whitelist()
|
||||||
def get_lead_details(lead):
|
def get_lead_details(lead):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user