Skip to content

Commit

Permalink
Merge pull request #44735 from frappe/mergify/bp/version-15-hotfix/pr…
Browse files Browse the repository at this point in the history
…-44660

fix: better indicator base amount for Tax Witholding in Journal Entry (backport #44660)
  • Loading branch information
vorasmit authored Dec 20, 2024
2 parents 162380d + db9a319 commit 58c0e24
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_

rate = tax_rate_map.get(tax_withholding_category)
if net_total_map.get((voucher_type, name)):
if voucher_type == "Journal Entry":
if voucher_type == "Journal Entry" and tax_amount and rate:
# back calcalute total amount from rate and tax_amount
if rate:
total_amount = grand_total = base_total = tax_amount / (rate / 100)
base_total = min(tax_amount / (rate / 100), net_total_map.get((voucher_type, name))[0])
total_amount = grand_total = base_total
elif voucher_type == "Purchase Invoice":
total_amount, grand_total, base_total, bill_no, bill_date = net_total_map.get(
(voucher_type, name)
Expand Down Expand Up @@ -405,7 +405,7 @@ def get_doc_info(vouchers, doctype, tax_category_map, net_total_map=None):
"paid_amount_after_tax",
"base_paid_amount",
],
"Journal Entry": ["total_amount"],
"Journal Entry": ["total_debit"],
}

entries = frappe.get_all(
Expand All @@ -427,7 +427,7 @@ def get_doc_info(vouchers, doctype, tax_category_map, net_total_map=None):
elif doctype == "Payment Entry":
value = [entry.paid_amount, entry.paid_amount_after_tax, entry.base_paid_amount]
else:
value = [entry.total_amount] * 3
value = [entry.total_debit] * 3

net_total_map[(doctype, entry.name)] = value

Expand Down

0 comments on commit 58c0e24

Please sign in to comment.