fix: User is not able to change item tax template
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index cc33b8b..a25429f 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -272,11 +272,14 @@
 		let me = this;
 		let item_codes = [];
 		let item_rates = {};
+		let item_tax_templates = {};
+
 		$.each(this.frm.doc.items || [], function(i, item) {
 			if (item.item_code) {
 				// Use combination of name and item code in case same item is added multiple times
 				item_codes.push([item.item_code, item.name]);
 				item_rates[item.name] = item.net_rate;
+				item_tax_templates[item.name] = item.item_tax_template
 			}
 		});
 
@@ -287,18 +290,16 @@
 					company: me.frm.doc.company,
 					tax_category: cstr(me.frm.doc.tax_category),
 					item_codes: item_codes,
+					item_tax_templates: item_tax_templates,
 					item_rates: item_rates
 				},
 				callback: function(r) {
 					if (!r.exc) {
 						$.each(me.frm.doc.items || [], function(i, item) {
-							if (item.name && r.message.hasOwnProperty(item.name)) {
+							if (item.name && r.message.hasOwnProperty(item.name) && r.message[item.name].item_tax_template) {
 								item.item_tax_template = r.message[item.name].item_tax_template;
 								item.item_tax_rate = r.message[item.name].item_tax_rate;
 								me.add_taxes_from_item_tax_template(item.item_tax_rate);
-							} else {
-								item.item_tax_template = "";
-								item.item_tax_rate = "{}";
 							}
 						});
 					}
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 746cbbf..bab004e 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -436,7 +436,7 @@
 	return itemwise_barcode
 
 @frappe.whitelist()
-def get_item_tax_info(company, tax_category, item_codes, item_rates=None):
+def get_item_tax_info(company, tax_category, item_codes, item_tax_templates, item_rates=None):
 	out = {}
 	if isinstance(item_codes, string_types):
 		item_codes = json.loads(item_codes)
@@ -444,12 +444,18 @@
 	if isinstance(item_rates, string_types):
 		item_rates = json.loads(item_rates)
 
+	if isinstance(item_tax_templates, string_types):
+		item_tax_templates = json.loads(item_tax_templates)
+
 	for item_code in item_codes:
-		if not item_code or item_code[1] in out:
+		if not item_code or item_code[1] in out or not item_tax_templates.get(item_code[1]):
 			continue
+
 		out[item_code[1]] = {}
 		item = frappe.get_cached_doc("Item", item_code[0])
-		args = {"company": company, "tax_category": tax_category, "net_rate": item_rates[item_code[1]]}
+		args = {"company": company, "tax_category": tax_category, "net_rate": item_rates[item_code[1]],
+			"item_tax_template": item_tax_templates.get(item_code[1])}
+
 		get_item_tax_template(args, item, out[item_code[1]])
 		out[item_code[1]]["item_tax_rate"] = get_item_tax_map(company, out[item_code[1]].get("item_tax_template"), as_json=True)
 
@@ -463,9 +469,7 @@
 		}
 	"""
 	item_tax_template = args.get("item_tax_template")
-
-	if not item_tax_template:
-		item_tax_template = _get_item_tax_template(args, item.taxes, out)
+	item_tax_template = _get_item_tax_template(args, item.taxes, out)
 
 	if not item_tax_template:
 		item_group = item.item_group
@@ -508,7 +512,8 @@
 		return None
 
 	# do not change if already a valid template
-	if args.get('item_tax_template') in taxes:
+	if args.get('item_tax_template') in [t.item_tax_template for t in taxes]:
+		out["item_tax_template"] = args.get('item_tax_template')
 		return args.get('item_tax_template')
 
 	for tax in taxes: