Skip to content

Commit ed42d54

Browse files
committed
fix: add base_tax_withholding_net_total to tax withholding report
1 parent b740846 commit ed42d54

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
5151
entries = {}
5252
for name, details in gle_map.items():
5353
for entry in details:
54-
tax_amount, total_amount, grand_total, base_total = 0, 0, 0, 0
54+
tax_amount, total_amount, grand_total, base_total, base_tax_withholding_net_total = 0, 0, 0, 0, 0
5555
tax_withholding_category, rate = None, None
5656
bill_no, bill_date = "", ""
5757
party = entry.party or entry.against
@@ -93,12 +93,16 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
9393

9494
grand_total = values[1]
9595
base_total = values[2]
96+
base_tax_withholding_net_total = total_amount
9697

9798
if voucher_type == "Purchase Invoice":
99+
base_tax_withholding_net_total = values[0]
98100
bill_no = values[3]
99101
bill_date = values[4]
102+
100103
else:
101104
total_amount += entry.credit
105+
base_tax_withholding_net_total = total_amount
102106

103107
if tax_amount:
104108
if party_map.get(party, {}).get("party_type") == "Supplier":
@@ -125,6 +129,7 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
125129
"rate": rate,
126130
"total_amount": total_amount,
127131
"grand_total": grand_total,
132+
"base_tax_withholding_net_total": base_tax_withholding_net_total,
128133
"base_total": base_total,
129134
"tax_amount": tax_amount,
130135
"transaction_date": posting_date,
@@ -251,6 +256,12 @@ def get_columns(filters):
251256
"fieldtype": "Percent",
252257
"width": 60,
253258
},
259+
{
260+
"label": _("Tax Withholding Net Total"),
261+
"fieldname": "base_tax_withholding_net_total",
262+
"fieldtype": "Float",
263+
"width": 150,
264+
},
254265
{
255266
"label": _("Taxable Amount"),
256267
"fieldname": "total_amount",

erpnext/accounts/report/tax_withholding_details/test_tax_withholding_details.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def test_tax_withholding_for_customers(self):
3535
result = execute(filters)[1]
3636
expected_values = [
3737
# Check for JV totals using back calculation logic
38-
[jv.name, "TCS", 0.075, -10000.0, -7.5, -10000.0],
39-
[pe.name, "TCS", 0.075, 2550, 0.53, 2550.53],
40-
[si.name, "TCS", 0.075, 1000, 0.52, 1000.52],
38+
[jv.name, "TCS", 0.075, -10000.0, -10000.0, -7.5, -10000.0],
39+
[pe.name, "TCS", 0.075, 2550, 2550, 0.53, 2550.53],
40+
[si.name, "TCS", 0.075, 1000, 1000, 0.52, 1000.52],
4141
]
4242
self.check_expected_values(result, expected_values)
4343

@@ -55,8 +55,8 @@ def test_single_account_for_multiple_categories(self):
5555
frappe._dict(company="_Test Company", party_type="Supplier", from_date=today(), to_date=today())
5656
)[1]
5757
expected_values = [
58-
[inv_1.name, "TDS - 1", 10, 5000, 500, 5500],
59-
[inv_2.name, "TDS - 2", 20, 5000, 1000, 6000],
58+
[inv_1.name, "TDS - 1", 10, 5000, 5000, 500, 5500],
59+
[inv_2.name, "TDS - 2", 20, 5000, 5000, 1000, 6000],
6060
]
6161
self.check_expected_values(result, expected_values)
6262

@@ -107,8 +107,8 @@ def test_date_filters_in_multiple_tax_withholding_rules(self):
107107
)[1]
108108

109109
expected_values = [
110-
[inv_1.name, "TDS - 3", 10.0, 5000, 500, 4500],
111-
[inv_2.name, "TDS - 3", 20.0, 5000, 1000, 4000],
110+
[inv_1.name, "TDS - 3", 10.0, 5000, 5000, 500, 4500],
111+
[inv_2.name, "TDS - 3", 20.0, 5000, 5000, 1000, 4000],
112112
]
113113
self.check_expected_values(result, expected_values)
114114

@@ -120,6 +120,7 @@ def check_expected_values(self, result, expected_values):
120120
voucher.ref_no,
121121
voucher.section_code,
122122
voucher.rate,
123+
voucher.base_tax_withholding_net_total,
123124
voucher.base_total,
124125
voucher.tax_amount,
125126
voucher.grand_total,

0 commit comments

Comments
 (0)