From b7cd84196d79f4a728a9a3aaf1504e62601aac5e Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 15 Sep 2020 09:42:51 +0530 Subject: [PATCH] fix: Revert tax calculation changes --- erpnext/controllers/taxes_and_totals.py | 10 +++------- erpnext/public/js/controllers/taxes_and_totals.js | 9 ++------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 59c60f7fdc..f578e7eac4 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -220,14 +220,10 @@ class calculate_taxes_and_totals(object): return current_tax_fraction, inclusive_tax_amount_per_qty def _get_tax_rate(self, tax, item_tax_map): - if item_tax_map: - if tax.account_head in item_tax_map: - return flt(item_tax_map.get(tax.account_head), self.doc.precision("rate", tax)) - else: - return tax.rate + if tax.account_head in item_tax_map: + return flt(item_tax_map.get(tax.account_head), self.doc.precision("rate", tax)) else: - # If no item tax template against item dont calculate tax against it - return 0 + return tax.rate def calculate_net_total(self): self.doc.total_qty = self.doc.total = self.doc.base_total = self.doc.net_total = self.doc.base_net_total = 0.0 diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 87f6d6a947..3bc70216db 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -223,13 +223,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ }, _get_tax_rate: function(tax, item_tax_map) { - if(!$.isEmptyObject(item_tax_map)) { - return (Object.keys(item_tax_map).indexOf(tax.account_head) != -1) ? - flt(item_tax_map[tax.account_head], precision("rate", tax)) : tax.rate; - } else { - // If no item tax template against item dont calculate tax against it - return 0; - } + return (Object.keys(item_tax_map).indexOf(tax.account_head) != -1) ? + flt(item_tax_map[tax.account_head], precision("rate", tax)) : tax.rate; }, calculate_net_total: function() {