Merge pull request #5364 from rohitwaghchaure/setup_wizard_access_issue

[Fix] Restrict access to setup wizard page if setup is already completed
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
index a61ad11..351cd56 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
@@ -3,6 +3,7 @@
 
 from __future__ import unicode_literals
 import frappe
+from frappe import _
 from frappe.model.document import Document
 from erpnext.controllers.accounts_controller import validate_taxes_and_charges, validate_inclusive_tax
 
@@ -19,6 +20,12 @@
 			where is_default = 1 and name != %s and company = %s""".format(doc.doctype),
 			(doc.name, doc.company))
 
+	validate_disabled(doc)
+
 	for tax in doc.get("taxes"):
 		validate_taxes_and_charges(tax)
 		validate_inclusive_tax(tax, doc)
+
+def validate_disabled(doc):
+	if doc.is_default and doc.disabled:
+		frappe.throw(_("Disabled template must not be default template"))
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py
index ce20d3a..be6f4a4 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.py
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py
@@ -140,4 +140,11 @@
 			if rule.get(key): rule.no_of_keys_matched += 1
 
 	rule = sorted(tax_rule, lambda b, a: cmp(a.no_of_keys_matched, b.no_of_keys_matched) or cmp(a.priority, b.priority))[0]
-	return rule.sales_tax_template or rule.purchase_tax_template
+
+	tax_template = rule.sales_tax_template or rule.purchase_tax_template
+	doctype = "{0} Taxes and Charges Template".format(rule.tax_type)
+
+	if frappe.db.get_value(doctype, tax_template, 'disabled')==1:
+		return None
+
+	return tax_template
diff --git a/erpnext/translations/kn.csv b/erpnext/translations/kn.csv
index 5c3d3e1..5c1843e 100644
--- a/erpnext/translations/kn.csv
+++ b/erpnext/translations/kn.csv
@@ -2066,7 +2066,7 @@
 DocType: Stock Ledger Entry,Actual Qty After Transaction,ವ್ಯವಹಾರದ ನಂತರ ನಿಜವಾದ ಪ್ರಮಾಣ
 ,Pending SO Items For Purchase Request,ಖರೀದಿ ವಿನಂತಿ ಆದ್ದರಿಂದ ಐಟಂಗಳು ಬಾಕಿ
 DocType: Supplier,Billing Currency,ಬಿಲ್ಲಿಂಗ್ ಕರೆನ್ಸಿ
-apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +148,Extra Large,ದೊಡ್ಡದು
+apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +148,Extra Large,ಎಕ್ಸ್ಟ್ರಾ ದೊಡ್ಡದು
 ,Profit and Loss Statement,ಲಾಭ ಮತ್ತು ನಷ್ಟ ಹೇಳಿಕೆ
 DocType: Bank Reconciliation Detail,Cheque Number,ಚೆಕ್ ಸಂಖ್ಯೆ
 DocType: Payment Tool Detail,Payment Tool Detail,ಪಾವತಿ ಉಪಕರಣ ವಿವರ
@@ -2076,7 +2076,7 @@
 apps/erpnext/erpnext/setup/setup_wizard/setup_wizard.py +362,Local,ಸ್ಥಳೀಯ
 apps/erpnext/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py +26,Loans and Advances (Assets),ಸಾಲ ಮತ್ತು ಅಡ್ವಾನ್ಸಸ್ ( ಆಸ್ತಿಗಳು )
 apps/erpnext/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py +12,Debtors,ಸಾಲಗಾರರು
-apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +147,Large,ದೊಡ್ಡದು
+apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +147,Large,ದೊಡ್ಡ
 DocType: C-Form Invoice Detail,Territory,ಕ್ಷೇತ್ರ
 apps/erpnext/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +139,Please mention no of visits required,ನಮೂದಿಸಿ ಅಗತ್ಯವಿದೆ ಭೇಟಿ ಯಾವುದೇ
 DocType: Stock Settings,Default Valuation Method,ಡೀಫಾಲ್ಟ್ ಮೌಲ್ಯಮಾಪನ ವಿಧಾನ