Merge pull request #17556 from Alchez/develop-lead-import-fix
feat(crm): Allow leads to be imported without person name
This commit is contained in:
commit
9706aaab65
@ -7,11 +7,13 @@ cur_frm.email_field = "email_id";
|
||||
erpnext.LeadController = frappe.ui.form.Controller.extend({
|
||||
setup: function () {
|
||||
this.frm.fields_dict.customer.get_query = function (doc, cdt, cdn) {
|
||||
return { query: "erpnext.controllers.queries.customer_query" } }
|
||||
return { query: "erpnext.controllers.queries.customer_query" }
|
||||
}
|
||||
|
||||
this.frm.toggle_reqd("lead_name", !this.frm.doc.organization_lead);
|
||||
},
|
||||
|
||||
onload: function () {
|
||||
|
||||
if (cur_frm.fields_dict.lead_owner.df.options.match(/^User/)) {
|
||||
cur_frm.fields_dict.lead_owner.get_query = function (doc, cdt, cdn) {
|
||||
return { query: "frappe.core.doctype.user.user.user_query" }
|
||||
@ -20,7 +22,8 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
|
||||
|
||||
if (cur_frm.fields_dict.contact_by.df.options.match(/^User/)) {
|
||||
cur_frm.fields_dict.contact_by.get_query = function (doc, cdt, cdn) {
|
||||
return { query: "frappe.core.doctype.user.user.user_query" } }
|
||||
return { query: "frappe.core.doctype.user.user.user_query" }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -64,11 +67,8 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
|
||||
},
|
||||
|
||||
organization_lead: function () {
|
||||
if (this.frm.doc.organization_lead == 1) {
|
||||
this.frm.set_df_property('company_name', 'reqd', 1);
|
||||
} else {
|
||||
this.frm.set_df_property('company_name', 'reqd', 0);
|
||||
}
|
||||
this.frm.toggle_reqd("lead_name", !this.frm.doc.organization_lead);
|
||||
this.frm.toggle_reqd("company_name", this.frm.doc.organization_lead);
|
||||
},
|
||||
|
||||
company_name: function () {
|
||||
|
@ -145,7 +145,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
@ -268,7 +268,7 @@
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Lead Owner",
|
||||
"length": 0,
|
||||
@ -1419,17 +1419,18 @@
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-user",
|
||||
"idx": 5,
|
||||
"image_field": "image",
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2019-04-11 22:12:50.029368",
|
||||
"modified": "2019-05-10 03:22:57.283628",
|
||||
"modified_by": "Administrator",
|
||||
"module": "CRM",
|
||||
"name": "Lead",
|
||||
|
@ -109,7 +109,11 @@ class Lead(SellingController):
|
||||
|
||||
def set_lead_name(self):
|
||||
if not self.lead_name:
|
||||
frappe.db.set_value("Lead", self.name, "lead_name", self.company_name)
|
||||
# Check for leads being created through data import
|
||||
if not self.company_name:
|
||||
frappe.throw(_("A Lead requires either a person's name or an organization's name"))
|
||||
|
||||
self.lead_name = self.company_name
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_customer(source_name, target_doc=None):
|
||||
|
Loading…
Reference in New Issue
Block a user