From d82c92a237dcc7512709897f997fa1097e3820c4 Mon Sep 17 00:00:00 2001 From: Dharanidharan S Date: Tue, 27 Jan 2026 14:08:16 +0530 Subject: [PATCH] fix(accounts): correct base grand total and rounded total mismatch (#51739) --- erpnext/public/js/controllers/taxes_and_totals.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 87ec985ad18..989f7d371d5 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -637,6 +637,12 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { tax_count ? this.frm.doc["taxes"][tax_count - 1].total + grand_total_diff : this.frm.doc.net_total ); + // total taxes and charges is calculated before adjusting base grand total + this.frm.doc.total_taxes_and_charges = flt( + this.frm.doc.grand_total - this.frm.doc.net_total - grand_total_diff, + precision("total_taxes_and_charges") + ); + if ( ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "POS Invoice"].includes( this.frm.doc.doctype @@ -679,11 +685,6 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { ]); } - this.frm.doc.total_taxes_and_charges = flt( - this.frm.doc.grand_total - this.frm.doc.net_total - grand_total_diff, - precision("total_taxes_and_charges") - ); - this.set_in_company_currency(this.frm.doc, ["total_taxes_and_charges"]); // Round grand total as per precision