From 153ad99f85ad5ef8a1b52663cd121328bf589f73 Mon Sep 17 00:00:00 2001 From: Luis Mendoza Date: Wed, 11 Feb 2026 20:49:15 +0000 Subject: [PATCH 1/3] fix(accounts): compute tax net_amount in JS controller --- erpnext/public/js/controllers/taxes_and_totals.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index daffda5d4be..255037e5af7 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -191,6 +191,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { tax.item_wise_tax_detail = {}; } var tax_fields = [ + "net_amount", "total", "tax_amount_after_discount_amount", "tax_amount_for_current_item", @@ -400,7 +401,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { var item_tax_map = me._load_item_tax_rate(item.item_tax_rate); $.each(doc.taxes, function (i, tax) { // tax_amount represents the amount of tax for the current step - var current_tax_amount = me.get_current_tax_amount(item, tax, item_tax_map); + var [current_net_amount, current_tax_amount] = me.get_current_tax_amount(item, tax, item_tax_map); if (frappe.flags.round_row_wise_tax) { current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax)); } @@ -419,6 +420,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { !(me.discount_amount_applied && me.frm.doc.apply_discount_on == "Grand Total") ) { tax.tax_amount += current_tax_amount; + tax.net_amount += current_net_amount; } // store tax_amount for current item as it will be used for @@ -555,7 +557,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { current_tax_amount = tax_rate * item.qty; } - return current_tax_amount; + return [current_net_amount, current_tax_amount]; } round_off_totals(tax) { @@ -565,6 +567,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { } tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax)); + tax.net_amount = flt(tax.net_amount, precision("net_amount", tax)); tax.tax_amount_after_discount_amount = flt( tax.tax_amount_after_discount_amount, precision("tax_amount", tax) From 485166b668b372ecff00e6638ced930b73bff3bc Mon Sep 17 00:00:00 2001 From: Luis Mendoza Date: Wed, 11 Feb 2026 21:18:44 +0000 Subject: [PATCH 2/3] style: prettier formatting --- erpnext/public/js/controllers/taxes_and_totals.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 255037e5af7..00b7be1c5fe 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -401,7 +401,11 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { var item_tax_map = me._load_item_tax_rate(item.item_tax_rate); $.each(doc.taxes, function (i, tax) { // tax_amount represents the amount of tax for the current step - var [current_net_amount, current_tax_amount] = me.get_current_tax_amount(item, tax, item_tax_map); + var [current_net_amount, current_tax_amount] = me.get_current_tax_amount( + item, + tax, + item_tax_map + ); if (frappe.flags.round_row_wise_tax) { current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax)); } From b10b20539471879da0fcaf64648cf22d598b7f82 Mon Sep 17 00:00:00 2001 From: Luis Mendoza Date: Wed, 18 Feb 2026 16:44:56 +0000 Subject: [PATCH 3/3] fix(accounts): round and convert net_amount to company currency in JS tax controller --- erpnext/public/js/controllers/taxes_and_totals.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 00b7be1c5fe..c53c1f8aef5 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -408,6 +408,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { ); if (frappe.flags.round_row_wise_tax) { current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax)); + current_net_amount = flt(current_net_amount, precision("net_amount", tax)); } // Adjust divisional loss to the last item @@ -486,7 +487,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { for (const [i, tax] of doc.taxes.entries()) { me.round_off_totals(tax); - me.set_in_company_currency(tax, ["tax_amount", "tax_amount_after_discount_amount"]); + me.set_in_company_currency(tax, ["tax_amount", "tax_amount_after_discount_amount", "net_amount"]); me.round_off_base_values(tax);