Merge pull request #5625 from KanchanChauhan/salary-component-cleanup

Salary component cleanup
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
index 14543c4..a6cc8ba 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
@@ -15,7 +15,7 @@
 	if not frappe.db.exists("Print Format", template_name):
 		cheque_print = frappe.new_doc("Print Format")
 		cheque_print.update({
-			"doc_type": "Journal Entry",
+			"doc_type": "Payment Entry",
 			"standard": "No",
 			"custom_format": 1,
 			"print_format_type": "Server",
@@ -35,24 +35,24 @@
 		</span>
 		<span style="top:%(date_dist_from_top_edge)s cm; left:%(date_dist_from_left_edge)scm;
 			position: absolute;">
-			{{doc.cheque_date or '' }}
+			{{doc.reference_date or '' }}
 		</span>
 		<span style="top:%(acc_no_dist_from_top_edge)scm;left:%(acc_no_dist_from_left_edge)scm;
 			position: absolute;">
-			{{ doc.account_no }}
+			{{ doc.account_no or '' }}
 		</span>
 		<span style="top:%(payer_name_from_top_edge)scm;left: %(payer_name_from_left_edge)scm;
 			position: absolute;">
-			{{doc.pay_to_recd_from}}
+			{{doc.party}}
 		</span>
 		<span style="top:%(amt_in_words_from_top_edge)scm; left:%(amt_in_words_from_left_edge)scm;
 			position: absolute; display: block; width: %(amt_in_word_width)scm;
 			line-height:%(amt_in_words_line_spacing)scm; word-wrap: break-word;">
-				{{doc.total_amount_in_words}}
+				{{frappe.utils.money_in_words(doc.base_paid_amount or doc.base_received_amount)}}
 		</span>
 		<span style="top:%(amt_in_figures_from_top_edge)scm;left: %(amt_in_figures_from_left_edge)scm;
 			position: absolute;">
-			{{doc.get_formatted("total_amount")}}
+			{{doc.get_formatted("base_paid_amount") or doc.get_formatted("base_received_amount")}}
 		</span>
 		<span style="top:%(signatory_from_top_edge)scm;left: %(signatory_from_left_edge)scm;
 			position: absolute;">
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.json b/erpnext/accounts/doctype/payment_entry/payment_entry.json
index d40ba9d..d816eb8 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.json
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.json
@@ -852,32 +852,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "depends_on": "difference_amount", 
-   "fieldname": "write_off_difference_amount", 
-   "fieldtype": "Button", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Write Off Difference Amount", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "set_exchange_gain_loss", 
    "fieldtype": "Button", 
    "hidden": 0, 
@@ -979,6 +953,32 @@
   {
    "allow_on_submit": 0, 
    "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "difference_amount", 
+   "fieldname": "write_off_difference_amount", 
+   "fieldtype": "Button", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Write Off Difference Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "deductions", 
    "depends_on": "eval:(doc.paid_amount && doc.received_amount)", 
@@ -1372,7 +1372,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-07-01 17:14:17.562924", 
+ "modified": "2016-07-04 15:00:53.731584", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Entry", 
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index d4d93a7..441760b 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -49,6 +49,7 @@
 		self.set_remarks()
 		
 	def on_submit(self):
+		self.setup_party_account_field()
 		if self.difference_amount:
 			frappe.throw(_("Difference Amount must be zero"))
 		self.make_gl_entries()
@@ -127,7 +128,7 @@
 	def validate_account_type(self, account, account_types):
 		account_type = frappe.db.get_value("Account", account, "account_type")
 		if account_type not in account_types:
-			frappe.throw(_("Account Type for {0} must be {1}").format(comma_or(account_types)))
+			frappe.throw(_("Account Type for {0} must be {1}").format(account, comma_or(account_types)))
 				
 	def set_exchange_rate(self):
 		if self.paid_from and not self.source_exchange_rate:
@@ -194,7 +195,7 @@
 					""", (self.party_account, self.party, d.reference_name), as_dict=True)
 
 				if not je_accounts:
-					frappe.throw(_("Row #{0}: Journal Entry {0} does not have account {1} or already matched against another voucher")
+					frappe.throw(_("Row #{0}: Journal Entry {1} does not have account {2} or already matched against another voucher")
 						.format(d.idx, d.reference_name, self.party_account))
 				else:
 					dr_or_cr = "debit" if self.payment_type == "Receive" else "credit"
@@ -270,6 +271,7 @@
 	def validate_payment_against_negative_invoice(self):
 		if ((self.payment_type=="Pay" and self.party_type=="Customer") 
 				or (self.payment_type=="Receive" and self.party_type=="Supplier")):
+				
 			total_negative_outstanding = sum([abs(flt(d.outstanding_amount)) 
 				for d in self.get("references") if flt(d.outstanding_amount) < 0])
 			
@@ -379,7 +381,7 @@
 				gle = party_gl_dict.copy()
 				
 				gle.update({
-					dr_or_cr + "_in_account_currency": d.unallocated_amount,
+					dr_or_cr + "_in_account_currency": self.unallocated_amount,
 					dr_or_cr: base_unallocated_amount
 				})
 
@@ -535,6 +537,7 @@
 
 @frappe.whitelist()	
 def get_account_details(account, date):
+	frappe.has_permission('Payment Entry', throw=True)
 	return frappe._dict({
 		"account_currency": get_account_currency(account),
 		"account_balance": get_balance_on(account, date),
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index f7d9586..a774e54 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -98,7 +98,7 @@
 		
 		bank_amount = self.grand_total
 		if party_account_currency == ref_doc.company_currency and party_account_currency != self.currency:
-			party_amount = self.base_grand_total
+			party_amount = ref_doc.base_grand_total
 		else:
 			party_amount = self.grand_total
 					
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 6bd5eb1..2d1b2db 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -434,15 +434,13 @@
 		dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
 		payment_dr_or_cr = "payment_gl_entry.debit_in_account_currency - payment_gl_entry.credit_in_account_currency"
 
-	invoice_list = frappe.db.sql("""select
-			voucher_no,	voucher_type, posting_date, 
-			ifnull(sum({dr_or_cr}), 0) as invoice_amount,
+	invoice_list = frappe.db.sql("""
+		select
+			voucher_no,	voucher_type, posting_date, ifnull(sum({dr_or_cr}), 0) as invoice_amount,
 			(
-				select
-					ifnull(sum({payment_dr_or_cr}), 0)
+				select ifnull(sum({payment_dr_or_cr}), 0)
 				from `tabGL Entry` payment_gl_entry
-				where
-					payment_gl_entry.against_voucher_type = invoice_gl_entry.voucher_type
+				where payment_gl_entry.against_voucher_type = invoice_gl_entry.voucher_type
 					and payment_gl_entry.against_voucher = invoice_gl_entry.voucher_no
 					and payment_gl_entry.party_type = invoice_gl_entry.party_type
 					and payment_gl_entry.party = invoice_gl_entry.party
@@ -452,10 +450,8 @@
 		from
 			`tabGL Entry` invoice_gl_entry
 		where
-			party_type = %(party_type)s
-			and party = %(party)s
-			and account = %(account)s
-			and {dr_or_cr} > 0
+			party_type = %(party_type)s and party = %(party)s 
+			and account = %(account)s and {dr_or_cr} > 0
 			{condition}
 			and ((voucher_type = 'Journal Entry'
 					and (against_voucher = '' or against_voucher is null))
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
index 726f767..6058cb4 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -39,6 +39,7 @@
 
 	refresh: function(frm, cdt, cdn) {
 		if (frm.doc.docstatus === 1) {
+			frm.dashboard.show_dashboard();
 			frm.add_custom_button(__("Make"),
 				function(){ frm.trigger("make_suppplier_quotation") }, __("Supplier Quotation"));
 
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation_links.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation_links.py
new file mode 100644
index 0000000..279d157
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation_links.py
@@ -0,0 +1,14 @@
+from frappe import _
+
+links = {
+	'fieldname': 'request_for_quotation',
+	# 'non_standard_fieldnames': {
+	# 	'Purchase Order': 'prevdoc_detail_docname',
+	# },
+	'transactions': [
+		{
+			'label': _('Related Documents'),
+			'items': ['Supplier Quotation']
+		},
+	]
+}
\ No newline at end of file
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index 9dd50f8..66b59a5 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -22,9 +22,14 @@
 					"description": _("Payment Request")
 				},
 				{
+					"type": "doctype",
+					"name": "Payment Entry",
+					"description": _("Bank/Cash transactions against party or for internal transfer")
+				},
+				{
 					"type": "report",
 					"name": "Accounts Receivable",
-					"doctype": "Sales Invoice",
+					"doctype": "Sales Invoice",	
 					"is_query_report": True
 				},
 				{
@@ -46,22 +51,16 @@
 				},
 				{
 					"type": "doctype",
-					"name": "Payment Entry",
-					"description": _("Payment entries against party or for internal transfer")
-				},
-				{
-					"type": "doctype",
 					"name": "Journal Entry",
 					"description": _("Accounting journal entries.")
 				},
 				{
-					"type": "page",
-					"name": "Tree",
+					"type": "doctype",
+					"name": "Account",
 					"icon": "icon-sitemap",
 					"label": _("Chart of Accounts"),
 					"route": "Tree/Account",
 					"description": _("Tree of financial accounts."),
-					"doctype": "Account",
 				},
 				{
 					"type": "report",
@@ -197,13 +196,12 @@
 			"label": _("Budget and Cost Center"),
 			"items": [
 				{
-					"type": "page",
-					"name": "Tree",
+					"type": "doctype",
+					"name": "Cost Center",
 					"icon": "icon-sitemap",
 					"label": _("Chart of Cost Centers"),
 					"route": "Tree/Cost Center",
 					"description": _("Tree of financial Cost Centers."),
-					"doctype": "Cost Center",
 				},
 				{
 					"type": "doctype",
@@ -236,6 +234,11 @@
 					"name": "Asset Movement",
 					"description": _("Transfer an asset from one warehouse to another")
 				},
+				{
+					"type": "doctype",
+					"name": "Cheque Print Template",
+					"description": _("Setup cheque dimensions for printing")
+				},
 			]
 		},
 		{
diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py
index b423ee9..3c947cb 100644
--- a/erpnext/config/buying.py
+++ b/erpnext/config/buying.py
@@ -96,13 +96,12 @@
 					"description": _("Price List master.")
 				},
 				{
-					"type": "page",
-					"name": "Tree",
+					"type": "doctype",
+					"name": "Item Group",
 					"icon": "icon-sitemap",
 					"label": _("Item Group"),
 					"link": "Tree/Item Group",
 					"description": _("Tree of Item Groups."),
-					"doctype": "Item Group",
 				},
 				{
 					"type": "doctype",
diff --git a/erpnext/config/crm.py b/erpnext/config/crm.py
index 178ee95..e25493c 100644
--- a/erpnext/config/crm.py
+++ b/erpnext/config/crm.py
@@ -85,31 +85,28 @@
 					"description": _("Sales campaigns."),
 				},
 				{
-					"type": "page",
+					"type": "doctype",
 					"label": _("Customer Group"),
-					"name": "Tree",
+					"name": "Customer Group",
 					"icon": "icon-sitemap",
 					"link": "Tree/Customer Group",
 					"description": _("Manage Customer Group Tree."),
-					"doctype": "Customer Group",
 				},
 				{
-					"type": "page",
+					"type": "doctype",
 					"label": _("Territory"),
-					"name": "Tree",
+					"name": "Territory",
 					"icon": "icon-sitemap",
 					"link": "Tree/Territory",
 					"description": _("Manage Territory Tree."),
-					"doctype": "Territory",
 				},
 				{
-					"type": "page",
+					"type": "doctype",
 					"label": _("Sales Person"),
-					"name": "Tree",
+					"name": "Sales Person",
 					"icon": "icon-sitemap",
 					"link": "Tree/Sales Person",
 					"description": _("Manage Sales Person Tree."),
-					"doctype": "Sales Person",
 				},
 			]
 		},
diff --git a/erpnext/config/manufacturing.py b/erpnext/config/manufacturing.py
index fbc9fb1..51c5ef9 100644
--- a/erpnext/config/manufacturing.py
+++ b/erpnext/config/manufacturing.py
@@ -39,12 +39,12 @@
 					"label": _("Bill of Materials")
 				},
 				{
-					"type": "page",
-					"name": "bom-browser",
+					"type": "doctype",
+					"name": "BOM",
 					"icon": "icon-sitemap",
 					"label": _("BOM Browser"),
 					"description": _("Tree of Bill of Materials"),
-					"doctype": "BOM"
+					"link": "Tree/BOM",
 				},
 				{
 					"type": "doctype",
diff --git a/erpnext/config/selling.py b/erpnext/config/selling.py
index 1a725e2..45ec1f7 100644
--- a/erpnext/config/selling.py
+++ b/erpnext/config/selling.py
@@ -28,13 +28,12 @@
 					"description": _("Customer database."),
 				},
 				{
-					"type": "page",
+					"type": "doctype",
 					"label": _("Customer Group"),
-					"name": "Tree",
+					"name": "Customer Group",
 					"icon": "icon-sitemap",
 					"link": "Tree/Customer Group",
 					"description": _("Manage Customer Group Tree."),
-					"doctype": "Customer Group",
 				},
 				{
 					"type": "doctype",
@@ -68,13 +67,12 @@
 					"description": _("Price List master.")
 				},
 				{
-					"type": "page",
-					"name": "Tree",
+					"type": "doctype",
+					"name": "Item Group",
 					"icon": "icon-sitemap",
 					"label": _("Item Group"),
 					"link": "Tree/Item Group",
 					"description": _("Tree of Item Groups."),
-					"doctype": "Item Group",
 				},
 				{
 					"type": "doctype",
@@ -99,13 +97,12 @@
 			"label": _("Sales Partners and Territory"),
 			"items": [
 				{
-					"type": "page",
+					"type": "doctype",
 					"label": _("Territory"),
-					"name": "Tree",
+					"name": "Territory",
 					"icon": "icon-sitemap",
 					"link": "Tree/Territory",
 					"description": _("Manage Territory Tree."),
-					"doctype": "Territory",
 				},
 				{
 					"type": "doctype",
@@ -113,13 +110,12 @@
 					"description": _("Manage Sales Partners."),
 				},
 				{
-					"type": "page",
+					"type": "doctype",
 					"label": _("Sales Person"),
-					"name": "Tree",
+					"name": "Sales Person",
 					"icon": "icon-sitemap",
 					"link": "Tree/Sales Person",
 					"description": _("Manage Sales Person Tree."),
-					"doctype": "Sales Person",
 				},
 				{
 					"type": "report",
diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py
index 320d906..5b78ca3 100644
--- a/erpnext/config/stock.py
+++ b/erpnext/config/stock.py
@@ -77,13 +77,12 @@
 					"description": _("Price List master.")
 				},
 				{
-					"type": "page",
-					"name": "Tree",
+					"type": "doctype",
+					"name": "Item Group",
 					"icon": "icon-sitemap",
 					"label": _("Item Group"),
 					"link": "Tree/Item Group",
 					"description": _("Tree of Item Groups."),
-					"doctype": "Item Group",
 				},
 				{
 					"type": "doctype",
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 5d43e70..d58d3dd 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -81,6 +81,13 @@
 			"parents": [{"title": _("Request for Quotation"), "name": "rfq"}]
 		}
 	},
+	{"from_route": "/addresses", "to_route": "Address"},
+	{"from_route": "/addresses/<path:name>", "to_route": "addresses",
+		"defaults": {
+			"doctype": "Address",
+			"parents": [{"title": _("Addresses"), "name": "addresses"}]
+		}
+	},
 	{"from_route": "/jobs", "to_route": "Job Opening"},
 ]
 
diff --git a/erpnext/patches/v7_0/create_warehouse_nestedset.py b/erpnext/patches/v7_0/create_warehouse_nestedset.py
index 0fa1756..af39cc8 100644
--- a/erpnext/patches/v7_0/create_warehouse_nestedset.py
+++ b/erpnext/patches/v7_0/create_warehouse_nestedset.py
@@ -47,6 +47,9 @@
 
 def make_warehouse_nestedset(company=None):
 	validate_parent_account_for_warehouse(company)
+	stock_account_group = get_stock_account_group(company.name)
+	if not stock_account_group and cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
+		return
 
 	if company:
 		warehouse_group = "{0} - {1}".format(_("All Warehouses"), company.abbr)
@@ -56,11 +59,11 @@
 		ignore_mandatory = True
 
 	if not frappe.db.get_value("Warehouse", warehouse_group):
-		create_default_warehouse_group(company, ignore_mandatory)
+		create_default_warehouse_group(company, stock_account_group, ignore_mandatory)
 
 	set_parent_to_warehouse(warehouse_group, company)
 	if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
-		set_parent_to_warehouse_acount(company)
+		set_parent_to_warehouse_account(company)
 
 def validate_parent_account_for_warehouse(company=None):
 	if not company:
@@ -78,13 +81,14 @@
 			if current_parent_accounts_for_warehouse:
 				frappe.db.set_value("Account", current_parent_accounts_for_warehouse[0][0], "account_type", "Stock")
 
-def create_default_warehouse_group(company=None, ignore_mandatory=False):
+def create_default_warehouse_group(company=None, stock_account_group=None, ignore_mandatory=False):
 	wh = frappe.get_doc({
 		"doctype": "Warehouse",
 		"warehouse_name": _("All Warehouses"),
 		"is_group": 1,
 		"company": company.name if company else "",
-		"parent_warehouse": ""
+		"parent_warehouse": "",
+		"create_account_under": stock_account_group
 	})
 
 	if ignore_mandatory:
@@ -99,7 +103,7 @@
 
 	rebuild_tree("Warehouse", "parent_warehouse")
 
-def set_parent_to_warehouse_acount(company):
+def set_parent_to_warehouse_account(company):
 	frappe.db.sql(""" update tabAccount set parent_account = %s
 		where is_group = 0 and account_type = "Warehouse"
 		and (warehouse is not null or warehouse != '') and company = %s
@@ -109,3 +113,13 @@
 
 def set_company_to_warehouse(company):
 	frappe.db.sql("update tabWahouse set company=%s", company)
+
+def get_stock_account_group(company):
+	stock_account_group = frappe.db.get_all('Account', filters = {'company': company, 'is_group': 1,
+		'account_type': 'Stock', 'root_type': 'Asset'}, limit=1)
+			
+	if not stock_account_group:
+		stock_account_group = frappe.db.get_all('Account', filters = {'company': company, 'is_group': 1,
+				'parent_account': '', 'root_type': 'Asset'}, limit=1)
+
+	return stock_account_group[0].name if stock_account_group else None
\ No newline at end of file
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index 511925c..0228fa1 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -317,7 +317,11 @@
 	load_erpnext_slides();
 	frappe.wiz.add_slide(erpnext.wiz.org);
 	frappe.wiz.add_slide(erpnext.wiz.branding);
-	frappe.wiz.add_slide(erpnext.wiz.users);
+
+	if (!(frappe.boot.limits && frappe.boot.limits.users===1)) {
+		frappe.wiz.add_slide(erpnext.wiz.users);
+	}
+
 	frappe.wiz.add_slide(erpnext.wiz.taxes);
 	frappe.wiz.add_slide(erpnext.wiz.customers);
 	frappe.wiz.add_slide(erpnext.wiz.suppliers);
diff --git a/erpnext/public/js/utils/document_flow.js b/erpnext/public/js/utils/document_flow.js
index eaad6f8..d453c68 100644
--- a/erpnext/public/js/utils/document_flow.js
+++ b/erpnext/public/js/utils/document_flow.js
@@ -5,23 +5,23 @@
 
 $.extend(frappe.document_flow, {
 	"Selling": {
-		"Sales Order": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"],
-		"Quotation": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"]
+		"Sales Order": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Payment Entry"],
+		"Quotation": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Payment Entry"]
 	},
 	"Accounts": {
-		"Sales Invoice": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"],
+		"Sales Invoice": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Payment Entry"],
 		"Purchase Invoice": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
-			"Purchase Invoice", "Journal Entry"]
+			"Purchase Invoice", "Payment Entry"]
 	},
 	"Buying": {
 		"Purchase Order": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
-			"Purchase Invoice", "Journal Entry"],
+			"Purchase Invoice", "Payment Entry"],
 		"Supplier Quotation": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
-			"Purchase Invoice", "Journal Entry"]
+			"Purchase Invoice", "Payment Entry"]
 	},
 	"Stock": {
-		"Delivery Note": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"],
+		"Delivery Note": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Payment Entry"],
 		"Purchase Receipt": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
-			"Purchase Invoice", "Journal Entry"]
+			"Purchase Invoice", "Payment Entry"]
 	}
 });
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index ffcac98..9d614dc 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -20,7 +20,6 @@
 
 	install_fixtures.install(args.get("country"))
 
-	update_setup_wizard_access()
 	create_price_lists(args)
 	create_fiscal_year_and_company(args)
 	create_users(args)
@@ -41,6 +40,7 @@
 
 	frappe.db.commit()
 	login_as_first_user(args)
+
 	frappe.db.commit()
 	frappe.clear_cache()
 
@@ -55,17 +55,6 @@
 
 			pass
 
-def update_setup_wizard_access():
-	if frappe.flags.in_test:
-		return
-	setup_wizard = frappe.get_doc('Page', 'setup-wizard')
-	for roles in setup_wizard.roles:
-		if roles.role == 'System Manager':
-			roles.role = 'Administrator'
-	setup_wizard.flags.ignore_permissions = 1
-	setup_wizard.flags.do_not_update_json = 1
-	setup_wizard.save()
-
 def create_fiscal_year_and_company(args):
 	if (args.get('fy_start_date')):
 		curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
@@ -88,13 +77,13 @@
 			'chart_of_accounts': args.get(('chart_of_accounts')),
 			'domain': args.get('domain')
 		}).insert()
-		
+
 		#Enable shopping cart
 		enable_shopping_cart(args)
-		
+
 		# Bank Account
 		create_bank_account(args)
-		
+
 def enable_shopping_cart(args):
 	frappe.get_doc({
 		"doctype": "Shopping Cart Settings",
@@ -103,8 +92,8 @@
 		'price_list': frappe.db.get_value("Price List", {"selling": 1}),
 		'default_customer_group': _("Individual"),
 		'quotation_series': "QTN-",
-	}).insert()	
-	
+	}).insert()
+
 def create_bank_account(args):
 	if args.get("bank_account"):
 		company_name = args.get('company_name').strip()
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 1f0fe34..1b1a56b 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -43,8 +43,6 @@
 		var me = this;
 		this._super();
 
-		this.frm.dashboard.reset();
-
 		if(doc.docstatus==0) {
 			cur_frm.add_custom_button(__("Get Items from BOM"),
 				cur_frm.cscript.get_items_from_bom, "icon-sitemap", "btn-default");
diff --git a/erpnext/stock/doctype/material_request/material_request_links.py b/erpnext/stock/doctype/material_request/material_request_links.py
index 7f12490..abd27dc 100644
--- a/erpnext/stock/doctype/material_request/material_request_links.py
+++ b/erpnext/stock/doctype/material_request/material_request_links.py
@@ -3,12 +3,11 @@
 links = {
 	'fieldname': 'material_request',
 	'non_standard_fieldnames': {
-		'Supplier Quotation': 'prevdoc_detail_docname',
 		'Purchase Order': 'prevdoc_detail_docname',
 	},
 	'transactions': [
 		{
-			'label': _('Documents'),
+			'label': _('Related Documents'),
 			'items': ['Request for Quotation', 'Supplier Quotation', 'Purchase Order']
 		},
 	]
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index adef7ce..938e73c 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -93,8 +93,6 @@
 			if parent_account:
 				frappe.db.set_value("Warehouse", self.name, "create_account_under", parent_account[0][0])
 				self.create_account_under = parent_account[0][0]
-			else:
-				frappe.throw(_("Please enter parent account group for warehouse {0}").format(self.name))
 		elif frappe.db.get_value("Account", self.create_account_under, "company") != self.company:
 			frappe.throw(_("Warehouse {0}: Parent account {1} does not bolong to the company {2}")
 				.format(self.name, self.create_account_under, self.company))
@@ -124,11 +122,11 @@
 			throw(_("Child warehouse exists for this warehouse. You can not delete this warehouse."))
 
 		self.update_nsm_model()
-	
+
 	def check_if_sle_exists(self):
 		return frappe.db.sql("""select name from `tabStock Ledger Entry`
 			where warehouse = %s""", self.name)
-	
+
 	def check_if_child_exists(self):
 		return frappe.db.sql("""select name from `tabWarehouse`
 			where parent_warehouse = %s""", self.name)
@@ -202,7 +200,7 @@
 
 		frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock)
 		frappe.db.auto_commit_on_many_writes = 0
-	
+
 	def convert_to_group_or_ledger(self):
 		if self.is_group:
 			self.convert_to_ledger()
@@ -220,11 +218,11 @@
 				doc = frappe.get_doc("Account", account_name)
 				doc.warehouse = self.name
 				doc.convert_group_to_ledger()
-			
+
 			self.is_group = 0
 			self.save()
 			return 1
-	
+
 	def convert_to_group(self):
 		if self.check_if_sle_exists():
 			throw(_("Warehouses with existing transaction can not be converted to group."))
@@ -255,7 +253,7 @@
 		is_group as expandable
 		from `tab{doctype}`
 		where docstatus < 2
-		and ifnull(`{parent_field}`,'') = %s 
+		and ifnull(`{parent_field}`,'') = %s
 		and (`company` = %s or company is null or company = '')
 		order by name""".format(doctype=frappe.db.escape(doctype),
 		parent_field=frappe.db.escape(parent_field)), (parent, company), as_dict=1)
@@ -292,4 +290,3 @@
 def convert_to_group_or_ledger():
 	args = frappe.form_dict
 	return frappe.get_doc("Warehouse", args.docname).convert_to_group_or_ledger()
-	
\ No newline at end of file
diff --git a/erpnext/templates/includes/address_row.html b/erpnext/templates/includes/address_row.html
index 15dcb95..2c5056a 100644
--- a/erpnext/templates/includes/address_row.html
+++ b/erpnext/templates/includes/address_row.html
@@ -1,8 +1,14 @@
 <div class="web-list-item">
     <a href="/addresses?name={{ doc.name | urlencode }}" class="no-decoration">
-        <h4 class="strong">{{ doc.address_title }}</h4>
-        <p class="text-muted small">
-            {{ frappe.get_doc(doc).get_display() }}
-        </p>
+	    <div class="row">
+	        <div class="col-xs-3">
+	                 <span class="indicator {{ "red" if doc.address_type=="Office" else "green" if doc.address_type=="Billing" else "blue" if doc.address_type=="Shipping" else "darkgrey" }}">{{ doc.address_title }}</span>
+			</div>
+			<div class="col-xs-2"> {{ doc.address_type }} </div>
+			<div class="col-xs-2"> {{ doc.city }} </div>
+			<div class="col-xs-5 text-right small text-muted">
+	            {{ frappe.get_doc(doc).get_display() }}
+	        </div>
+	    </div>
     </a>
 </div>
diff --git a/erpnext/utilities/address_and_contact.py b/erpnext/utilities/address_and_contact.py
index a2e566f..324f679 100644
--- a/erpnext/utilities/address_and_contact.py
+++ b/erpnext/utilities/address_and_contact.py
@@ -8,13 +8,13 @@
 	"""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)}) \
+	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",
+		doc.get("__onload")["contact_list"] = frappe.get_all("Contact",
 			fields="*", filters={key: doc.name},
 			order_by="is_primary_contact desc, modified desc")
 
diff --git a/erpnext/utilities/doctype/address/address.py b/erpnext/utilities/doctype/address/address.py
index f613faa..1d215cc 100644
--- a/erpnext/utilities/doctype/address/address.py
+++ b/erpnext/utilities/doctype/address/address.py
@@ -9,6 +9,7 @@
 
 from frappe.model.document import Document
 from jinja2 import TemplateSyntaxError
+from frappe.utils.user import is_website_user
 
 class Address(Document):
 	def __setup__(self):
@@ -123,11 +124,22 @@
 	from erpnext.shopping_cart.cart import get_address_docs
 	return {
 		"title": _("Addresses"),
-		"get_list": get_address_docs,
+		"get_list": get_address_list,
 		"row_template": "templates/includes/address_row.html",
 		'no_breadcrumbs': True,
 	}
+	
+def get_address_list(doctype, txt, filters, limit_start, limit_page_length=20):
+	from frappe.www.list import get_list
+	user = frappe.session.user
+	ignore_permissions = False
+	if is_website_user():
+		if not filters: filters = []
+		filters.append(("Address", "owner", "=", user))
+		ignore_permissions = True
 
+	return get_list(doctype, txt, filters, limit_start, limit_page_length, ignore_permissions=ignore_permissions)
+	
 def has_website_permission(doc, ptype, user, verbose=False):
 	"""Returns true if customer or lead matches with user"""
 	customer = frappe.db.get_value("Contact", {"email_id": frappe.session.user}, "customer")