From 86cd4cc739e313f4736f3c71f2b5348239db8695 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sat, 28 Feb 2015 19:11:51 +0530 Subject: [PATCH] discount related fix --- erpnext/controllers/taxes_and_totals.py | 5 +++-- erpnext/public/js/controllers/taxes_and_totals.js | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 2d5df155c3..c846dd08cd 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -73,8 +73,9 @@ class calculate_taxes_and_totals(object): def initialize_taxes(self): for tax in self.doc.get("taxes"): - validate_taxes_and_charges(tax) - validate_inclusive_tax(tax, self.doc) + if not self.discount_amount_applied: + validate_taxes_and_charges(tax) + validate_inclusive_tax(tax, self.doc) tax.item_wise_tax_detail = {} tax_fields = ["total", "tax_amount_after_discount_amount", diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index d07c91737e..9c321cc25e 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -94,8 +94,10 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ $.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 }); - cur_frm.cscript.validate_taxes_and_charges(tax.doctype, tax.name); - me.validate_inclusive_tax(tax); + if (!this.discount_amount_applied) { + cur_frm.cscript.validate_taxes_and_charges(tax.doctype, tax.name); + me.validate_inclusive_tax(tax); + } frappe.model.round_floats_in(tax); }); },