Merge branch 'develop' into lms-link-fix
diff --git a/erpnext/accounts/doctype/bank/bank_dashboard.py b/erpnext/accounts/doctype/bank/bank_dashboard.py
new file mode 100644
index 0000000..4324041
--- /dev/null
+++ b/erpnext/accounts/doctype/bank/bank_dashboard.py
@@ -0,0 +1,18 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'bank',
+		'transactions': [
+			{
+				'label': _('Bank Deatils'),
+				'items': ['Bank Account', 'Bank Guarantee']
+			},
+			{
+				'items': ['Payment Order']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py b/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py
new file mode 100644
index 0000000..3d149eb
--- /dev/null
+++ b/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py
@@ -0,0 +1,30 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'bank_account',
+		'non_standard_fieldnames': {
+			'Customer': 'default_bank_account',
+			'Supplier': 'default_bank_account',
+			'Journal Entry': 'bank_account_no'
+		},
+		'transactions': [
+			{
+				'label': _('Payments'),
+				'items': ['Payment Entry', 'Payment Request', 'Payment Order']
+			},
+			{
+				'label': _('Party'),
+				'items': ['Customer', 'Supplier']
+			},
+			{
+				'items': ['Bank Guarantee']
+			},
+			{
+				'items': ['Journal Entry']
+			}
+		]
+	}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/cost_center/cost_center_dashboard.py b/erpnext/accounts/doctype/cost_center/cost_center_dashboard.py
new file mode 100644
index 0000000..788ac8b
--- /dev/null
+++ b/erpnext/accounts/doctype/cost_center/cost_center_dashboard.py
@@ -0,0 +1,15 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'cost_center',
+		'reports': [
+			{
+				'label': _('Reports'),
+				'items': ['Budget Variance Report', 'General Ledger']
+			}
+		]
+	}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/finance_book/finance_book_dashboard.py b/erpnext/accounts/doctype/finance_book/finance_book_dashboard.py
new file mode 100644
index 0000000..c2ebea6
--- /dev/null
+++ b/erpnext/accounts/doctype/finance_book/finance_book_dashboard.py
@@ -0,0 +1,25 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'finance_book',
+		'non_standard_fieldnames': {
+			'Asset': 'default_finance_book',
+			'Company': 'default_finance_book'
+		},
+		'transactions': [
+			{
+				'label': _('Assets'),
+				'items': ['Asset', 'Asset Value Adjustment']
+			},
+			{
+				'items': ['Company']
+			},
+			{
+				'items': ['Journal Entry']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year_dashboard.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year_dashboard.py
new file mode 100644
index 0000000..c7604ec
--- /dev/null
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year_dashboard.py
@@ -0,0 +1,23 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'fiscal_year',
+		'transactions': [
+			{
+				'label': _('Budgets'),
+				'items': ['Budget']
+			},
+			{
+				'label': _('References'),
+				'items': ['Period Closing Voucher', 'Request for Quotation', 'Tax Withholding Category']
+			},
+			{
+				'label': _('Target Details'),
+				'items': ['Sales Person', 'Sales Partner', 'Territory', 'Monthly Distribution']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py b/erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py
new file mode 100644
index 0000000..acc308e
--- /dev/null
+++ b/erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py
@@ -0,0 +1,26 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'item_tax_template',
+		'transactions': [
+			{
+				'label': _('Pre Sales'),
+				'items': ['Quotation', 'Supplier Quotation']
+			},
+			{
+				'label': _('Sales'),
+				'items': ['Sales Invoice', 'Sales Order', 'Delivery Note']
+			},
+			{
+				'label': _('Purchase'),
+				'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt']
+			},
+			{
+				'items': ['Item']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index 9be30aa..b7f383f 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -25,13 +25,13 @@
 					"group_by_voucher": 0
 				};
 				frappe.set_route("query-report", "General Ledger");
-			}, "fa fa-table");
+			}, __('View'));
 		}
 
 		if(frm.doc.docstatus==1) {
 			frm.add_custom_button(__('Reverse Journal Entry'), function() {
 				return erpnext.journal_entry.reverse_journal_entry(frm);
-			});
+			}, __('Make'));
 		}
 
 		if (frm.doc.__islocal) {
@@ -47,8 +47,7 @@
 			frm.add_custom_button(__("Create Inter Company Journal Entry"),
 				function() {
 					frm.trigger("make_inter_company_journal_entry");
-				}
-			);
+				}, __('Make'));
 		}
 	},
 
diff --git a/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py b/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py
new file mode 100644
index 0000000..189004f
--- /dev/null
+++ b/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py
@@ -0,0 +1,14 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'loyalty_program',
+		'transactions': [
+			{
+				'items': ['Sales Invoice', 'Customer']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py
new file mode 100644
index 0000000..a679499
--- /dev/null
+++ b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py
@@ -0,0 +1,23 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'monthly_distribution',
+		'non_standard_fieldnames': {
+			'Sales Person': 'distribution_id',
+			'Territory': 'distribution_id',
+			'Sales Partner': 'distribution_id',
+		},
+		'transactions': [
+			{
+				'label': _('Target Details'),
+				'items': ['Sales Person', 'Territory', 'Sales Partner']
+			},
+			{
+				'items': ['Budget']
+			}
+		]
+	}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py
new file mode 100644
index 0000000..0898229
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py
@@ -0,0 +1,20 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'payment_gateway_account',
+		'non_standard_fieldnames': {
+			'Subscription Plan': 'payment_gateway'
+		},
+		'transactions': [
+			{
+				'items': ['Payment Request']
+			},
+			{
+				'items': ['Subscription Plan']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/payment_term/payment_term_dashboard.py b/erpnext/accounts/doctype/payment_term/payment_term_dashboard.py
new file mode 100644
index 0000000..d146fcd
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_term/payment_term_dashboard.py
@@ -0,0 +1,22 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'payment_term',
+		'transactions': [
+			{
+				'label': _('Sales'),
+				'items': ['Sales Invoice', 'Sales Order', 'Quotation']
+			},
+			{
+				'label': _('Purchase'),
+				'items': ['Purchase Invoice', 'Purchase Order']
+			},
+			{
+				'items': ['Payment Terms Template']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py
new file mode 100644
index 0000000..c705097
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py
@@ -0,0 +1,33 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'payment_terms_template',
+		'non_standard_fieldnames': {
+			'Customer Group': 'payment_terms',
+			'Supplier Group': 'payment_terms',
+			'Supplier': 'payment_terms',
+			'Customer': 'payment_terms'
+		},
+		'transactions': [
+			{
+				'label': _('Sales'),
+				'items': ['Sales Invoice', 'Sales Order', 'Quotation']
+			},
+			{
+				'label': _('Purchase'),
+				'items': ['Purchase Invoice', 'Purchase Order']
+			},
+			{
+				'label': _('Party'),
+				'items': ['Customer', 'Supplier']
+			},
+			{
+				'label': _('Group'),
+				'items': ['Customer Group', 'Supplier Group']
+			}
+		]
+	}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py b/erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py
new file mode 100644
index 0000000..e28bf73
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py
@@ -0,0 +1,14 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'pos_profile',
+		'transactions': [
+			{
+				'items': ['Sales Invoice', 'POS Closing Voucher']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py
new file mode 100644
index 0000000..11c220b
--- /dev/null
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py
@@ -0,0 +1,22 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'taxes_and_charges',
+		'non_standard_fieldnames': {
+			'Tax Rule': 'purchase_tax_template',
+		},
+		'transactions': [
+			{
+				'label': _('Transactions'),
+				'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt']
+			},
+			{
+				'label': _('References'),
+				'items': ['Supplier Quotation', 'Tax Rule']
+			}
+		]
+	}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py
new file mode 100644
index 0000000..0e9c808
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py
@@ -0,0 +1,24 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'taxes_and_charges',
+		'non_standard_fieldnames': {
+			'Tax Rule': 'sales_tax_template',
+			'Subscription': 'tax_template',
+			'Restaurant': 'default_tax_template'
+		},
+		'transactions': [
+			{
+				'label': _('Transactions'),
+				'items': ['Sales Invoice', 'Sales Order', 'Delivery Note']
+			},
+			{
+				'label': _('References'),
+				'items': ['POS Profile', 'Subscription', 'Restaurant', 'Tax Rule']
+			}
+		]
+	}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/share_type/share_type_dashboard.py b/erpnext/accounts/doctype/share_type/share_type_dashboard.py
new file mode 100644
index 0000000..455b022
--- /dev/null
+++ b/erpnext/accounts/doctype/share_type/share_type_dashboard.py
@@ -0,0 +1,15 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'share_type',
+		'transactions': [
+			{
+				'label': _('References'),
+				'items': ['Share Transfer', 'Shareholder']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py b/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py
new file mode 100644
index 0000000..3b77fd5
--- /dev/null
+++ b/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py
@@ -0,0 +1,17 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'shareholder',
+		'non_standard_fieldnames': {
+			'Share Transfer': 'to_shareholder'
+		},
+		'transactions': [
+			{
+				'items': ['Share Transfer']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/shipping_rule/shipping_rule_dashboard.py b/erpnext/accounts/doctype/shipping_rule/shipping_rule_dashboard.py
new file mode 100644
index 0000000..636ee57
--- /dev/null
+++ b/erpnext/accounts/doctype/shipping_rule/shipping_rule_dashboard.py
@@ -0,0 +1,26 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'shipping_rule',
+		'non_standard_fieldnames': {
+			'Payment Entry': 'party_name'
+		},
+		'transactions': [
+			{
+				'label': _('Pre Sales'),
+				'items': ['Quotation', 'Supplier Quotation']
+			},
+			{
+				'label': _('Sales'),
+				'items': ['Sales Order', 'Delivery Note', 'Sales Invoice']
+			},
+			{
+				'label': _('Purchase'),
+				'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py b/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py
new file mode 100644
index 0000000..df30233
--- /dev/null
+++ b/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py
@@ -0,0 +1,19 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'subscription_plan',
+		'non_standard_fieldnames': {
+			'Payment Request': 'plan',
+			'Subscription': 'plan'
+		},
+		'transactions': [
+			{
+				'label': _('References'),
+				'items': ['Payment Request', 'Subscription']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/tax_category/tax_category_dashboard.py b/erpnext/accounts/doctype/tax_category/tax_category_dashboard.py
new file mode 100644
index 0000000..d643efb
--- /dev/null
+++ b/erpnext/accounts/doctype/tax_category/tax_category_dashboard.py
@@ -0,0 +1,31 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'tax_category',
+		'transactions': [
+			{
+				'label': _('Pre Sales'),
+				'items': ['Quotation', 'Supplier Quotation']
+			},
+			{
+				'label': _('Sales'),
+				'items': ['Sales Invoice', 'Delivery Note', 'Sales Order']
+			},
+			{
+				'label': _('Purchase'),
+				'items': ['Purchase Invoice', 'Purchase Receipt']
+			},
+			{
+				'label': _('Party'),
+				'items': ['Customer', 'Supplier']
+			},
+			{
+				'label': _('Taxes'),
+				'items': ['Item', 'Tax Rule']
+			}
+		]
+	}
diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py
new file mode 100644
index 0000000..d51ba65
--- /dev/null
+++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py
@@ -0,0 +1,14 @@
+from __future__ import unicode_literals
+
+from frappe import _
+
+
+def get_data():
+	return {
+		'fieldname': 'tax_withholding_category',
+		'transactions': [
+			{
+				'items': ['Supplier']
+			}
+		]
+	}
diff --git a/erpnext/education/doctype/course/test_records.json b/erpnext/education/doctype/course/test_records.json
index ec57dc7..1e7467a 100644
--- a/erpnext/education/doctype/course/test_records.json
+++ b/erpnext/education/doctype/course/test_records.json
@@ -1,17 +1,14 @@
 [
 	{
-		"course_name": "_Test Course",
-		"course_code": "TC100",
+		"course_name": "TC100",
 		"course_abbreviation": "TC"
 	},
 	{
-		"course_name": "_Test Course 1",
-		"course_code": "TC101",
+		"course_name": "TC101",
 		"course_abbreviation": "TC1"
 	},
 	{
-		"course_name": "_Test Course 2",
-		"course_code": "TC102",
+		"course_name": "TC102",
 		"course_abbreviation": "TC2"
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/education/doctype/program/test_records.json b/erpnext/education/doctype/program/test_records.json
index 7901db3..4013695 100644
--- a/erpnext/education/doctype/program/test_records.json
+++ b/erpnext/education/doctype/program/test_records.json
@@ -1,13 +1,11 @@
 [
 	{
-		"program_name": "_Test Program 1",
-		"program_code": "_TP1",
+		"program_name": "_TP1",
 		"description": "Test Description",
 		"program_abbreviation": "TP1"
 	},
 	{
-		"program_name": "_Test Program 2",
-		"program_code": "_TP2",
+		"program_name": "_TP2",
 		"description": "Test Description",
 		"program_abbreviation": "TP2"
 	}
diff --git a/erpnext/education/doctype/program_enrollment/program_enrollment.py b/erpnext/education/doctype/program_enrollment/program_enrollment.py
index d232e47..d5348ff 100644
--- a/erpnext/education/doctype/program_enrollment/program_enrollment.py
+++ b/erpnext/education/doctype/program_enrollment/program_enrollment.py
@@ -66,7 +66,7 @@
 			msgprint(_("Fee Records Created - {0}").format(comma_and(fee_list)))
 
 	def get_courses(self):
-		return frappe.db.sql('''select course, course_name from `tabProgram Course` where parent = %s and required = 1''', (self.program), as_dict=1)
+		return frappe.db.sql('''select course from `tabProgram Course` where parent = %s and required = 1''', (self.program), as_dict=1)
 
 	def create_course_enrollments(self):
 		student = frappe.get_doc("Student", self.student)
diff --git a/erpnext/www/lms/course.py b/erpnext/www/lms/course.py
index e7ed2e3..c18d64e 100644
--- a/erpnext/www/lms/course.py
+++ b/erpnext/www/lms/course.py
@@ -5,9 +5,16 @@
 no_cache = 1
 
 def get_context(context):
+	try:
+		program = frappe.form_dict['program']
+		course_name = frappe.form_dict['name']
+	except KeyError:
+		frappe.local.flags.redirect_location = '/lms'
+		raise frappe.Redirect
+
 	context.education_settings = frappe.get_single("Education Settings")
-	course = frappe.get_doc('Course', frappe.form_dict['name'])
-	context.program = frappe.form_dict['program']
+	course = frappe.get_doc('Course', course_name)
+	context.program = program
 	context.course = course
 
 	context.topics = course.get_topics()
diff --git a/erpnext/www/lms/program.py b/erpnext/www/lms/program.py
index 1fcb3d3..7badedc 100644
--- a/erpnext/www/lms/program.py
+++ b/erpnext/www/lms/program.py
@@ -6,10 +6,16 @@
 no_cache = 1
 
 def get_context(context):
+	try:
+		program = frappe.form_dict['program']
+	except KeyError:
+		frappe.local.flags.redirect_location = '/lms'
+		raise frappe.Redirect
+
 	context.education_settings = frappe.get_single("Education Settings")
-	context.program = get_program(frappe.form_dict['program'])
+	context.program = get_program(program)
 	context.courses = [frappe.get_doc("Course", course.course) for course in context.program.courses]
-	context.has_access = utils.allowed_program_access(frappe.form_dict['program'])
+	context.has_access = utils.allowed_program_access(program)
 	context.progress = get_course_progress(context.courses, context.program)
 
 def get_program(program_name):
diff --git a/erpnext/www/lms/topic.py b/erpnext/www/lms/topic.py
index 0af0778..f75ae8e 100644
--- a/erpnext/www/lms/topic.py
+++ b/erpnext/www/lms/topic.py
@@ -5,9 +5,13 @@
 no_cache = 1
 
 def get_context(context):
-	course = frappe.form_dict['course']
-	program = frappe.form_dict['program']
-	topic = frappe.form_dict['topic']
+	try:
+		course = frappe.form_dict['course']
+		program = frappe.form_dict['program']
+		topic = frappe.form_dict['topic']
+	except KeyError:
+		frappe.local.flags.redirect_location = '/lms'
+		raise frappe.Redirect
 
 	context.program = program
 	context.course = course