From 08fb39f1ba6c11279755ca883bca57a3760cd5b1 Mon Sep 17 00:00:00 2001 From: Alec Ruiz-Ramon Date: Tue, 9 Aug 2016 15:38:34 -0400 Subject: [PATCH] Validate on changing from Total to Valuation/Valuation&Total when add_deduct_tax is 'Deduct' --- .../purchase_taxes_and_charges_template.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 433cda7372a..0d37d00221b 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 @@ frappe.ui.form.on("Purchase Taxes and Charges", "add_deduct_tax", function(doc, } 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'); +})