fix: removing organization_lead traceback

This commit is contained in:
Anupam 2021-08-06 11:47:07 +05:30
parent 4723e18f9e
commit 01a0585ba0
5 changed files with 5 additions and 7 deletions

View File

@ -71,7 +71,7 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
}
company_name () {
if (this.frm.doc.organization_lead && !this.frm.doc.lead_name) {
if (!this.frm.doc.lead_name) {
this.frm.set_value("lead_name", this.frm.doc.company_name);
}
}

View File

@ -35,7 +35,7 @@ class TestLead(unittest.TestCase):
customer.insert()
def test_create_lead_and_unlinking_dynamic_links(self):
lead_doc = make_lead(first_name = "Lorem", last_name="Ipsum")
lead_doc = make_lead(first_name = "Lorem", last_name="Ipsum", email_id="lorem_ipsum@example.com")
lead_doc_1 = make_lead()
frappe.get_doc({
"doctype": "Address",
@ -79,7 +79,7 @@ def make_lead(**args):
"doctype": "Lead",
"first_name": args.first_name or "Test",
"last_name": args.last_name or "Lead",
"email_id": args.email_id or "new_lead{}@example.com".format(random_string(5)),
"email_id": args.email_id or "new_lead_{}@example.com".format(random_string(5)),
}).insert()
return lead_doc

View File

@ -27,7 +27,6 @@
{
"doctype": "Lead",
"email_id": "test_lead4@example.com",
"organization_lead": 1,
"lead_name": "_Test Lead 4",
"company_name": "_Test Lead 4",
"status": "Open"

View File

@ -9,7 +9,6 @@ QUnit.test("test: lead", function (assert) {
() => frappe.set_route("List", "Lead"),
() => frappe.new_doc("Lead"),
() => frappe.timeout(1),
() => cur_frm.set_value("organization_lead", "1"),
() => cur_frm.set_value("company_name", lead_name),
() => cur_frm.save(),
() => frappe.timeout(1),

View File

@ -176,12 +176,12 @@ class Customer(TransactionBase):
address.append('links', dict(link_doctype='Customer', link_name=self.name))
address.save(ignore_permissions=self.flags.ignore_permissions)
lead = frappe.db.get_value("Lead", self.lead_name, ["organization_lead", "lead_name", "email_id", "phone", "mobile_no", "gender", "salutation"], as_dict=True)
lead = frappe.db.get_value("Lead", self.lead_name, ["company_name", "lead_name", "email_id", "phone", "mobile_no", "gender", "salutation"], as_dict=True)
if not lead.lead_name:
frappe.throw(_("Please mention the Lead Name in Lead {0}").format(self.lead_name))
if lead.organization_lead:
if lead.company_name:
contact_names = frappe.get_all('Dynamic Link', filters={
"parenttype":"Contact",
"link_doctype":"Lead",