feat(crm): Allow leads to be imported without person name
This commit is contained in:
parent
b10392134d
commit
9778ff8ab3
@ -7,11 +7,13 @@ cur_frm.email_field = "email_id";
|
|||||||
erpnext.LeadController = frappe.ui.form.Controller.extend({
|
erpnext.LeadController = frappe.ui.form.Controller.extend({
|
||||||
setup: function () {
|
setup: function () {
|
||||||
this.frm.fields_dict.customer.get_query = function (doc, cdt, cdn) {
|
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 () {
|
onload: function () {
|
||||||
|
|
||||||
if (cur_frm.fields_dict.lead_owner.df.options.match(/^User/)) {
|
if (cur_frm.fields_dict.lead_owner.df.options.match(/^User/)) {
|
||||||
cur_frm.fields_dict.lead_owner.get_query = function (doc, cdt, cdn) {
|
cur_frm.fields_dict.lead_owner.get_query = function (doc, cdt, cdn) {
|
||||||
return { query: "frappe.core.doctype.user.user.user_query" }
|
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/)) {
|
if (cur_frm.fields_dict.contact_by.df.options.match(/^User/)) {
|
||||||
cur_frm.fields_dict.contact_by.get_query = function (doc, cdt, cdn) {
|
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 () {
|
organization_lead: function () {
|
||||||
if (this.frm.doc.organization_lead == 1) {
|
this.frm.toggle_reqd("lead_name", !this.frm.doc.organization_lead);
|
||||||
this.frm.set_df_property('company_name', 'reqd', 1);
|
this.frm.toggle_reqd("company_name", this.frm.doc.organization_lead);
|
||||||
} else {
|
|
||||||
this.frm.set_df_property('company_name', 'reqd', 0);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
company_name: function () {
|
company_name: function () {
|
||||||
|
@ -145,7 +145,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 1,
|
"search_index": 1,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"translatable": 0,
|
"translatable": 0,
|
||||||
@ -268,7 +268,7 @@
|
|||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_global_search": 0,
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Lead Owner",
|
"label": "Lead Owner",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
@ -1419,17 +1419,18 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"has_web_view": 0,
|
||||||
|
"hide_heading": 0,
|
||||||
"hide_toolbar": 0,
|
"hide_toolbar": 0,
|
||||||
"icon": "fa fa-user",
|
"icon": "fa fa-user",
|
||||||
"idx": 5,
|
"idx": 5,
|
||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
|
"image_view": 0,
|
||||||
"in_create": 0,
|
"in_create": 0,
|
||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"modified": "2019-05-10 03:22:57.283628",
|
||||||
"modified": "2019-04-11 22:12:50.029368",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "CRM",
|
"module": "CRM",
|
||||||
"name": "Lead",
|
"name": "Lead",
|
||||||
|
@ -109,7 +109,11 @@ class Lead(SellingController):
|
|||||||
|
|
||||||
def set_lead_name(self):
|
def set_lead_name(self):
|
||||||
if not self.lead_name:
|
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()
|
@frappe.whitelist()
|
||||||
def make_customer(source_name, target_doc=None):
|
def make_customer(source_name, target_doc=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user