mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
[bean] [mandatory] fixes in test cases
This commit is contained in:
@@ -100,7 +100,17 @@ class DocType(SellingController):
|
||||
@webnotes.whitelist()
|
||||
def make_customer(source_name, target_doclist=None):
|
||||
from webnotes.model.mapper import get_mapped_doclist
|
||||
|
||||
|
||||
def set_missing_values(source, target):
|
||||
if source.doc.company_name:
|
||||
target[0].customer_type = "Company"
|
||||
target[0].customer_name = source.doc.company_name
|
||||
else:
|
||||
target[0].customer_type = "Individual"
|
||||
target[0].customer_name = source.doc.lead_name
|
||||
|
||||
target[0].customer_group = webnotes.conn.get_default("customer_group")
|
||||
|
||||
doclist = get_mapped_doclist("Lead", source_name,
|
||||
{"Lead": {
|
||||
"doctype": "Customer",
|
||||
@@ -110,7 +120,7 @@ def make_customer(source_name, target_doclist=None):
|
||||
"contact_no": "phone_1",
|
||||
"fax": "fax_1"
|
||||
}
|
||||
}}, target_doclist)
|
||||
}}, target_doclist, set_missing_values)
|
||||
|
||||
return [d.fields for d in doclist]
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
test_records = [
|
||||
[{"doctype":"Lead", "lead_name": "_Test Lead", "status":"Open",
|
||||
"email_id":"test_lead@example.com"}],
|
||||
"email_id":"test_lead@example.com", "territory": "_Test Territory"}],
|
||||
[{"doctype":"Lead", "lead_name": "_Test Lead 1", "status":"Open",
|
||||
"email_id":"test_lead1@example.com"}],
|
||||
[{"doctype":"Lead", "lead_name": "_Test Lead 2", "status":"Contacted",
|
||||
@@ -21,6 +21,7 @@ class TestLead(unittest.TestCase):
|
||||
customer = make_customer("_T-Lead-00001")
|
||||
self.assertEquals(customer[0]["doctype"], "Customer")
|
||||
self.assertEquals(customer[0]["lead_name"], "_T-Lead-00001")
|
||||
|
||||
|
||||
customer[0].customer_group = "_Test Customer Group"
|
||||
webnotes.bean(customer).insert()
|
||||
|
||||
Reference in New Issue
Block a user