feat: move to newer contacts structure

This commit is contained in:
Himanshu Warekar 2019-08-08 23:50:03 +05:30
parent 224c2ddaf4
commit f94d183297
3 changed files with 11 additions and 8 deletions

View File

@ -45,15 +45,16 @@ class TestOpportunity(unittest.TestCase):
# create new customer and create new contact against 'new.opportunity@example.com' # create new customer and create new contact against 'new.opportunity@example.com'
customer = make_customer(opp_doc.party_name).insert(ignore_permissions=True) customer = make_customer(opp_doc.party_name).insert(ignore_permissions=True)
frappe.get_doc({ d = frappe.get_doc({
"doctype": "Contact", "doctype": "Contact",
"email_id": new_lead_email_id,
"first_name": "_Test Opportunity Customer", "first_name": "_Test Opportunity Customer",
"links": [{ "links": [{
"link_doctype": "Customer", "link_doctype": "Customer",
"link_name": customer.name "link_name": customer.name
}] }]
}).insert(ignore_permissions=True) })
d.add_email(new_lead_email_id)
d.insert(ignore_permissions=True)
opp_doc = frappe.get_doc(args).insert(ignore_permissions=True) opp_doc = frappe.get_doc(args).insert(ignore_permissions=True)
self.assertTrue(opp_doc.party_name) self.assertTrue(opp_doc.party_name)

View File

@ -68,12 +68,13 @@ def make_contact(supplier):
contact = frappe.get_doc({ contact = frappe.get_doc({
'doctype': 'Contact', 'doctype': 'Contact',
'first_name': supplier.supplier_name, 'first_name': supplier.supplier_name,
'email_id': supplier.supplier_email,
'is_primary_contact': 1, 'is_primary_contact': 1,
'links': [ 'links': [
{'link_doctype': 'Supplier', 'link_name': supplier.supplier_name} {'link_doctype': 'Supplier', 'link_name': supplier.supplier_name}
] ]
}).insert() })
contact.add_email(supplier.supplier_email)
contact.insert()
else: else:
contact = frappe.get_doc('Contact', contact_name) contact = frappe.get_doc('Contact', contact_name)

View File

@ -337,14 +337,15 @@ def make_contact(args, is_primary_contact=1):
contact = frappe.get_doc({ contact = frappe.get_doc({
'doctype': 'Contact', 'doctype': 'Contact',
'first_name': args.get('name'), 'first_name': args.get('name'),
'mobile_no': args.get('mobile_no'),
'email_id': args.get('email_id'),
'is_primary_contact': is_primary_contact, 'is_primary_contact': is_primary_contact,
'links': [{ 'links': [{
'link_doctype': args.get('doctype'), 'link_doctype': args.get('doctype'),
'link_name': args.get('name') 'link_name': args.get('name')
}] }]
}).insert() })
contact.add_email(args.get('email_id'))
contact.add_phone(args.get('mobile_no'))
contact.insert()
return contact return contact