Validate on changing from Total to Valuation/Valuation&Total when add_deduct_tax is 'Deduct'
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js
index 433cda7..0d37d00 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js
@@ -18,3 +18,13 @@
}
refresh_field('add_deduct_tax', d.name, 'taxes');
});
+
+frappe.ui.form.on("Purchase Taxes and Charges", "category", function(doc, cdt, cdn) {
+ var d = locals[cdt][cdn];
+
+ if (d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
+ msgprint(__("Cannot deduct when category is for 'Valuation' or 'Vaulation and Total'"));
+ d.add_deduct_tax = '';
+ }
+ refresh_field('add_deduct_tax', d.name, 'taxes');
+})