fix: tax calc changes in js

This commit is contained in:
Dany Robert 2023-08-23 03:59:08 +00:00
parent 3ead28906c
commit c20258d2a3
2 changed files with 9 additions and 6 deletions

View File

@ -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

View File

@ -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") {