Merge branch 'version-12-hotfix' into contacts-ref
diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py
index 1a9f66a..8927d93 100644
--- a/erpnext/crm/doctype/opportunity/test_opportunity.py
+++ b/erpnext/crm/doctype/opportunity/test_opportunity.py
@@ -45,15 +45,16 @@
# create new customer and create new contact against 'new.opportunity@example.com'
customer = make_customer(opp_doc.party_name).insert(ignore_permissions=True)
- frappe.get_doc({
+ d = frappe.get_doc({
"doctype": "Contact",
- "email_id": new_lead_email_id,
"first_name": "_Test Opportunity Customer",
"links": [{
"link_doctype": "Customer",
"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)
self.assertTrue(opp_doc.party_name)
diff --git a/erpnext/hub_node/legacy.py b/erpnext/hub_node/legacy.py
index 95ada76..85eb1b2 100644
--- a/erpnext/hub_node/legacy.py
+++ b/erpnext/hub_node/legacy.py
@@ -68,12 +68,13 @@
contact = frappe.get_doc({
'doctype': 'Contact',
'first_name': supplier.supplier_name,
- 'email_id': supplier.supplier_email,
'is_primary_contact': 1,
'links': [
{'link_doctype': 'Supplier', 'link_name': supplier.supplier_name}
]
- }).insert()
+ })
+ contact.add_email(supplier.supplier_email)
+ contact.insert()
else:
contact = frappe.get_doc('Contact', contact_name)
diff --git a/erpnext/public/js/templates/contact_list.html b/erpnext/public/js/templates/contact_list.html
index 893b4e0..a90580f 100644
--- a/erpnext/public/js/templates/contact_list.html
+++ b/erpnext/public/js/templates/contact_list.html
@@ -14,19 +14,30 @@
style="margin-top:-3px; margin-right: -5px;">
{%= __("Edit") %}</a>
</p>
- {% if (contact_list[i].phone || contact_list[i].mobile_no ||
- contact_list[i].email_id) { %}
+ {% if (contact_list[i].phones || contact_list[i].email_ids) { %}
<p>
- {% if(contact_list[i].phone) { %}
- {%= __("Phone") %}: {%= contact_list[i].phone %}<br>
- {% } %}
- {% if(contact_list[i].mobile_no) { %}
- {%= __("Mobile No.") %}: {%= contact_list[i].mobile_no %}<br>
- {% } %}
- {% if(contact_list[i].email_id) { %}
- {%= __("Email Address") %}: {%= contact_list[i].email_id %}
- {% } %}
+ {% if(contact_list[i].phone) { %}
+ {%= __("Phone ") %}: <b>{%= contact_list[i].phone %}</b><br>
+ {% endif %}
+ {% if(contact_list[i].phone_nos) { %}
+ {% for(var j=0, k=contact_list[i].phone_nos.length; j<k; j++) { %}
+ {%= __("Phone ") %}: {%= contact_list[i].phone_nos[j].phone %}<br>
+ {% } %}
+ {% endif %}
</p>
+ <p>
+ {% if(contact_list[i].email_id) { %}
+ {%= __("Email ") %}: <b>{%= contact_list[i].email_id %}</b><br>
+ {% endif %}
+ {% if(contact_list[i].email_ids) { %}
+ {% for(var j=0, k=contact_list[i].email_ids.length; j<k; j++) { %}
+ {%= __("Email ") %}: {%= contact_list[i].email_ids[j].email_id %}<br>
+ {% } %}
+ {% endif %}
+ </p>
+ {% endif %}
+ {% if (contact_list[i].address) { %}
+ {%= __("Address ") %}: {%= contact_list[i].address %}<br>
{% endif %}
</div>
{% } %}
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index c946c47..d0b4ba0 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -337,14 +337,15 @@
contact = frappe.get_doc({
'doctype': 'Contact',
'first_name': args.get('name'),
- 'mobile_no': args.get('mobile_no'),
- 'email_id': args.get('email_id'),
'is_primary_contact': is_primary_contact,
'links': [{
'link_doctype': args.get('doctype'),
'link_name': args.get('name')
}]
- }).insert()
+ })
+ contact.add_email(args.get('email_id'))
+ contact.add_phone(args.get('mobile_no'))
+ contact.insert()
return contact