From 4d587344929c053fcaf1971e52ee410308bdecdd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 30 May 2019 15:50:46 +0530 Subject: [PATCH 1/2] fix: Rounding adjustment while additional discount amount is aplied on grand total --- erpnext/controllers/taxes_and_totals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index b75b8b825c..d5f86a1586 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -397,7 +397,7 @@ class calculate_taxes_and_totals(object): net_total += item.net_amount # discount amount rounding loss adjustment if no taxes - if (not taxes or self.doc.apply_discount_on == "Net Total") \ + if (self.doc.apply_discount_on == "Net Total" or not taxes or total_for_discount_amount==self.doc.net_total) \ and i == len(self.doc.get("items")) - 1: discount_amount_loss = flt(self.doc.net_total - net_total - self.doc.discount_amount, self.doc.precision("net_total")) From d060890817f52b404cdf2ad8855e216510e7402e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 30 May 2019 15:50:46 +0530 Subject: [PATCH 2/2] fix: Rounding adjustment while additional discount amount is aplied on grand total --- erpnext/public/js/controllers/taxes_and_totals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index b3c853815f..91800cd9a9 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -515,7 +515,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ net_total += item.net_amount; // discount amount rounding loss adjustment if no taxes - if ((!(me.frm.doc.taxes || []).length || (me.frm.doc.apply_discount_on == "Net Total")) + if ((!(me.frm.doc.taxes || []).length || total_for_discount_amount==me.frm.doc.net_total || (me.frm.doc.apply_discount_on == "Net Total")) && i == (me.frm.doc.items || []).length - 1) { var discount_amount_loss = flt(me.frm.doc.net_total - net_total - me.frm.doc.discount_amount, precision("net_total"));