fix: Use normal rounding for Tax Withholding Category (#34114)
diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
index 2c829b2..f0146ea 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
@@ -278,7 +278,7 @@
tax_amount = get_tcs_amount(parties, inv, tax_details, vouchers, advance_vouchers)
if cint(tax_details.round_off_tax_amount):
- tax_amount = round(tax_amount)
+ tax_amount = normal_round(tax_amount)
return tax_amount, tax_deducted, tax_deducted_on_advances, voucher_wise_amount
@@ -603,3 +603,20 @@
valid = True
return valid
+
+
+def normal_round(number):
+ """
+ Rounds a number to the nearest integer.
+ :param number: The number to round.
+ """
+ decimal_part = number - int(number)
+
+ if decimal_part >= 0.5:
+ decimal_part = 1
+ else:
+ decimal_part = 0
+
+ number = int(number) + decimal_part
+
+ return number