Merge pull request #6481 from rohitwaghchaure/fix_homepage

Fixed view button functionality in homepage
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index ae5db6d..b449e2a 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '7.0.49'
+__version__ = '7.0.50'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js
index db15eef..8aee1ba 100644
--- a/erpnext/accounts/doctype/account/account_tree.js
+++ b/erpnext/accounts/doctype/account/account_tree.js
@@ -48,5 +48,24 @@
 				+ " " + dr_or_cr
 				+ '</span>').insertBefore(node.$ul);
 		}
-	}
+	},
+	toolbar: [
+		{
+			condition: function(node) {
+				return !node.root && frappe.boot.user.can_read.indexOf("GL Entry") !== -1
+			},
+			label: __("View Ledger"),
+			click: function(node, btn) {
+				frappe.route_options = {
+					"account": node.label,
+					"from_date": sys_defaults.year_start_date,
+					"to_date": sys_defaults.year_end_date,
+					"company": frappe.defaults.get_default('company') ? frappe.defaults.get_default('company'): ""
+				};
+				frappe.set_route("query-report", "General Ledger");
+			},
+			btnClass: "hidden-xs"
+		}
+	],
+	extend_toolbar: true
 }
\ No newline at end of file
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.py b/erpnext/accounts/report/cash_flow/cash_flow.py
index 3407526..35d501a 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.py
+++ b/erpnext/accounts/report/cash_flow/cash_flow.py
@@ -59,7 +59,6 @@
 	company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
 	
 	for cash_flow_account in cash_flow_accounts:
-
 		section_data = []
 		data.append({
 			"account_name": cash_flow_account['section_header'], 
@@ -82,7 +81,8 @@
 			account_data = get_account_type_based_data(filters.company, 
 				account['account_type'], period_list, filters.accumulated_values)
 			account_data.update({
-				"account_name": account['label'], 
+				"account_name": account['label'],
+				"account": account['label'], 
 				"indent": 1,
 				"parent_account": cash_flow_account['section_header'],
 				"currency": company_currency
@@ -129,7 +129,7 @@
 def add_total_row_account(out, data, label, period_list, currency):
 	total_row = {
 		"account_name": "'" + _("{0}").format(label) + "'",
-		"account": None,
+		"account": "'" + _("{0}").format(label) + "'",
 		"currency": currency
 	}
 	for row in data:
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
index 62d6e69..f9e43db 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
@@ -34,7 +34,7 @@
 		total = 0
 		net_profit_loss = {
 			"account_name": "'" + _("Net Profit / Loss") + "'",
-			"account": None,
+			"account": "'" + _("Net Profit / Loss") + "'",
 			"warn_if_negative": True,
 			"currency": frappe.db.get_value("Company", company, "default_currency")
 		}
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 07bf0f0..be0013e 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -282,7 +282,7 @@
 erpnext.patches.v7_0.convert_timelogbatch_to_timesheet
 erpnext.patches.v7_0.convert_timelog_to_timesheet
 erpnext.patches.v7_0.move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet
-erpnext.patches.v7_0.remove_doctypes_and_reports
+erpnext.patches.v7_0.remove_doctypes_and_reports #2016-10-29
 erpnext.patches.v7_0.update_maintenance_module_in_doctype
 erpnext.patches.v7_0.update_prevdoc_values_for_supplier_quotation_item
 erpnext.patches.v7_0.rename_advance_table_fields
diff --git a/erpnext/patches/v7_0/remove_doctypes_and_reports.py b/erpnext/patches/v7_0/remove_doctypes_and_reports.py
index 0a302b1..3c45be4 100644
--- a/erpnext/patches/v7_0/remove_doctypes_and_reports.py
+++ b/erpnext/patches/v7_0/remove_doctypes_and_reports.py
@@ -5,6 +5,21 @@
 		frappe.db.sql("""delete from `tabDocType`
 			where name in('Time Log Batch', 'Time Log Batch Detail', 'Time Log')""")
 
+	frappe.db.sql("""delete from `tabDocField` where parent in ('Time Log', 'Time Log Batch')""")
+	frappe.db.sql("""update `tabCustom Script` set dt = 'Timesheet' where dt = 'Time Log'""")
+
+	for data in frappe.db.sql(""" select label, fieldname from  `tabCustom Field` where dt = 'Time Log'""", as_dict=1):
+		custom_field = frappe.get_doc({
+			'doctype': 'Custom Field',
+			'label': data.label,
+			'dt': 'Timesheet Detail',
+			'fieldname': data.fieldname
+		}).insert(ignore_permissions=True)
+
+	frappe.db.sql("""delete from `tabCustom Field` where dt = 'Time Log'""")
+	frappe.reload_doc('projects', 'doctype', 'timesheet')
+	frappe.reload_doc('projects', 'doctype', 'timesheet_detail')
+
 	report = "Daily Time Log Summary"
 	if frappe.db.exists("Report", report):
 		frappe.delete_doc('Report', report)
\ No newline at end of file