From c20258d2a355388b799b6e9eca710d9254cd0388 Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Wed, 23 Aug 2023 03:59:08 +0000 Subject: [PATCH] fix: tax calc changes in js --- .../accounts/doctype/payment_entry/payment_entry.py | 5 ----- erpnext/public/js/controllers/taxes_and_totals.js | 10 +++++++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 39ee497fda..ac31e8a1db 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1387,9 +1387,6 @@ class PaymentEntry(AccountsController): def calculate_taxes(self): self.total_taxes_and_charges = 0.0 self.base_total_taxes_and_charges = 0.0 - frappe.flags.round_row_wise_tax = ( - frappe.db.get_single_value("Accounts Settings", "round_row_wise_tax") - ) actual_tax_dict = dict( [ @@ -1401,8 +1398,6 @@ class PaymentEntry(AccountsController): for i, tax in enumerate(self.get("taxes")): current_tax_amount = self.get_current_tax_amount(tax) - if frappe.flags.round_row_wise_tax: - current_tax_amount = flt(current_tax_amount, tax.precision("tax_amount")) if tax.charge_type == "Actual": actual_tax_dict[tax.idx] -= current_tax_amount diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index eeb09cb8b0..8062ce05cd 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -185,7 +185,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { frappe.flags.round_off_applicable_accounts = []; if (me.frm.doc.company) { - return frappe.call({ + frappe.call({ "method": "erpnext.controllers.taxes_and_totals.get_round_off_applicable_accounts", "args": { "company": me.frm.doc.company, @@ -198,6 +198,11 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { } }); } + + frappe.db.get_single_value("Accounts Settings", "round_row_wise_tax") + .then((round_row_wise_tax) => { + frappe.flags.round_row_wise_tax = round_row_wise_tax; + }) } determine_exclusive_rate() { @@ -338,6 +343,9 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { $.each(me.frm.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); + if (frappe.flags.round_row_wise_tax) { + current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax)); + } // Adjust divisional loss to the last item if (tax.charge_type == "Actual") {