Merge pull request #3712 from rmehta/setup-wizard-fix

[fix] contact name in setup wizard
This commit is contained in:
Anand Doshi 2015-07-23 16:46:09 +05:30
commit db9762be3f

View File

@ -417,13 +417,8 @@ def create_customers(args):
}).insert() }).insert()
if args.get("customer_contact_" + str(i)): if args.get("customer_contact_" + str(i)):
contact = args.get("customer_contact_" + str(i)).split(" ") create_contact(args.get("customer_contact_" + str(i)),
frappe.get_doc({ "customer", customer)
"doctype":"Contact",
"customer": customer,
"first_name":contact[0],
"last_name": len(contact) > 1 and contact[1] or ""
}).insert()
except frappe.NameError: except frappe.NameError:
pass pass
@ -440,16 +435,21 @@ def create_suppliers(args):
}).insert() }).insert()
if args.get("supplier_contact_" + str(i)): if args.get("supplier_contact_" + str(i)):
contact = args.get("supplier_contact_" + str(i)).split(" ") create_contact(args.get("supplier_contact_" + str(i)),
frappe.get_doc({ "supplier", supplier)
"doctype":"Contact",
"supplier": supplier,
"first_name":contact[0],
"last_name": len(contact) > 1 and contact[1] or ""
}).insert()
except frappe.NameError: except frappe.NameError:
pass pass
def create_contact(contact, party_type, party):
"""Create contact based on given contact name"""
contact = contact.strip().split(" ")
frappe.get_doc({
"doctype":"Contact",
party_type: party,
"first_name":contact[0],
"last_name": len(contact) > 1 and contact[1] or ""
}).insert()
def create_letter_head(args): def create_letter_head(args):
if args.get("attach_letterhead"): if args.get("attach_letterhead"):