Merge pull request #5372 from rohitwaghchaure/setup_wizard_translation_issue

[Translation] [Fix] Exception in setup wizard, item attributes Large and Extra Large has same translation
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