[refactor] address and contact list in customer, supplier, lead, sales person
diff --git a/erpnext/public/js/templates/address_list.html b/erpnext/public/js/templates/address_list.html
new file mode 100644
index 0000000..e85723f
--- /dev/null
+++ b/erpnext/public/js/templates/address_list.html
@@ -0,0 +1,20 @@
+<p><button class="btn btn-sm btn-default btn-address">
+    <i class="icon-plus"></i> New Address</button></p>
+{% for(var i=0, l=addr_list.length; i<l; i++) { %}
+    <hr>
+    <a href="#Form/Address/{%= addr_list[i].name %}" class="btn btn-sm btn-default pull-right">
+        {%= __("Edit") %}</a>
+    <p><b>{%= i+1 %}. {%= addr_list[i].address_type %}</b></p>
+    <div style="padding-left: 15px;">
+        <div>
+            {% if(addr_list[i].is_primary_address) { %}<span class="label label-info">
+                {%= __("Primary") %}</span>{% } %}
+            {% if(addr_list[i].is_shipping_address) { %}<span class="label label-default">
+                {%= __("Shipping") %}</span>{% } %}
+        </div>
+        <p style="margin-top: 5px;">{%= addr_list[i].display %}</p>
+    </div>
+{% } %}
+{% if(!addr_list.length) { %}
+<p class="text-muted">{%= __("No address added yet.") %}</p>
+{% } %}
diff --git a/erpnext/public/js/templates/contact_list.html b/erpnext/public/js/templates/contact_list.html
new file mode 100644
index 0000000..ac192ea
--- /dev/null
+++ b/erpnext/public/js/templates/contact_list.html
@@ -0,0 +1,18 @@
+<p><button class="btn btn-sm btn-default btn-contact">
+    <i class="icon-plus"></i> New Contact</button></p>
+{% for(var i=0, l=contact_list.length; i<l; i++) { %}
+    <hr>
+    <a href="#Form/Contact/{%= contact_list[i].name %}" class="btn btn-sm btn-default pull-right">
+        {%= __("Edit") %}</a>
+    <p><b>{%= i+1 %}. {%= contact_list[i].first_name %} {%= contact_list[i].last_name %}</b></p>
+    <div style="padding-left: 15px;">
+        <div>
+            {% if(contact_list[i].is_primary_contact) { %}<span class="label label-info">
+                {%= __("Primary") %}</span>{% } %}
+        </div>
+        <p style="padding-top: 5px;">{%= __("Phone") %}: {%= contact_list[i].phone %}</p>
+    </div>
+{% } %}
+{% if(!contact_list.length) { %}
+<p class="text-muted">{%= __("No contacts added yet.") %}</p>
+{% } %}
diff --git a/erpnext/utilities/address_and_contact.py b/erpnext/utilities/address_and_contact.py
new file mode 100644
index 0000000..382c98c
--- /dev/null
+++ b/erpnext/utilities/address_and_contact.py
@@ -0,0 +1,19 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def load_address_and_contact(doc, key):
+	"""Loads address list and contact list in `__onload`"""
+	from erpnext.utilities.doctype.address.address import get_address_display
+
+	doc.get("__onload").addr_list = [a.update({"display": get_address_display(a)}) \
+		for a in frappe.get_all("Address",
+			fields="*", filters={key: doc.name},
+			order_by="is_primary_address desc, modified desc")]
+
+	if doc.doctype != "Lead":
+		doc.get("__onload").contact_list = frappe.get_all("Contact",
+			fields="*", filters={key: doc.name},
+			order_by="is_primary_contact desc, modified desc")