Merge pull request #5000 from nabinhait/develop

Minor fixes
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 26b4221..9a9a865 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -174,8 +174,9 @@
 	
 	company: function() {
 		var me = this;
-		if (!this.frm.doc.shipping_address) {
-			erpnext.utils.get_shipping_address(this.frm)
+		if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") 
+			&& !this.frm.doc.shipping_address) {
+				erpnext.utils.get_shipping_address(this.frm)
 		}
 	},
 	
diff --git a/erpnext/setup/setup_wizard/sample_data.py b/erpnext/setup/setup_wizard/sample_data.py
index 0e9ef06..63fc2e7 100644
--- a/erpnext/setup/setup_wizard/sample_data.py
+++ b/erpnext/setup/setup_wizard/sample_data.py
@@ -15,6 +15,7 @@
 	selling_items = frappe.get_all("Item", filters = {"is_sales_item": 1})
 	buying_items = frappe.get_all("Item", filters = {"is_purchase_item": 1})
 	customers = frappe.get_all("Customer")
+	warehouses = frappe.get_all("Warehouse")
 
 	if selling_items and customers:
 		for i in range(3):
@@ -24,7 +25,7 @@
 
 	make_projects()
 
-	if buying_items:
+	if buying_items and warehouses:
 		make_material_request(buying_items)
 
 	frappe.db.commit()