mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-11 14:29:12 +00:00
Merge pull request #17790 from deepeshgarg007/customer_lead_dashboard
fix: Customer and Lead dashboard fixes for opportunity and quotation
This commit is contained in:
@@ -6,6 +6,18 @@ cur_frm.email_field = "email_id";
|
||||
|
||||
erpnext.LeadController = frappe.ui.form.Controller.extend({
|
||||
setup: function () {
|
||||
|
||||
this.frm.make_methods = {
|
||||
'Quotation': () => erpnext.utils.create_new_doc('Quotation', {
|
||||
'quotation_to': this.frm.doc.doctype,
|
||||
'party_name': this.frm.doc.name
|
||||
}),
|
||||
'Opportunity': () => erpnext.utils.create_new_doc('Opportunity', {
|
||||
'opportunity_from': this.frm.doc.doctype,
|
||||
'party_name': this.frm.doc.name
|
||||
})
|
||||
}
|
||||
|
||||
this.frm.fields_dict.customer.get_query = function (doc, cdt, cdn) {
|
||||
return { query: "erpnext.controllers.queries.customer_query" }
|
||||
}
|
||||
|
||||
@@ -286,6 +286,16 @@ $.extend(erpnext.utils, {
|
||||
refresh_field(table_fieldname);
|
||||
},
|
||||
|
||||
create_new_doc: function (doctype, update_fields) {
|
||||
frappe.model.with_doctype(doctype, function() {
|
||||
var new_doc = frappe.model.get_new_doc(doctype);
|
||||
for (let [key, value] of Object.entries(update_fields)) {
|
||||
new_doc[key] = value;
|
||||
}
|
||||
frappe.ui.form.make_quick_entry(doctype, null, null, new_doc);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
erpnext.utils.select_alternate_items = function(opts) {
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
|
||||
frappe.ui.form.on("Customer", {
|
||||
setup: function(frm) {
|
||||
|
||||
frm.make_methods = {
|
||||
'Quotation': () => erpnext.utils.create_new_doc('Quotation', {
|
||||
'quotation_to': frm.doc.doctype,
|
||||
'party_name': frm.doc.name
|
||||
}),
|
||||
'Opportunity': () => erpnext.utils.create_new_doc('Opportunity', {
|
||||
'opportunity_from': frm.doc.doctype,
|
||||
'party_name': frm.doc.name
|
||||
})
|
||||
}
|
||||
|
||||
frm.add_fetch('lead_name', 'company_name', 'customer_name');
|
||||
frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate');
|
||||
frm.set_query('customer_group', {'is_group': 0});
|
||||
|
||||
Reference in New Issue
Block a user