fix: Show itemised TDS breakup based on Apply TDS checkbox on item level

This commit is contained in:
Nabin Hait
2024-04-08 20:26:44 +05:30
parent 711bc3ff1c
commit 4e3c885808
8 changed files with 61 additions and 5 deletions

View File

@@ -466,7 +466,16 @@ class calculate_taxes_and_totals:
if tax.charge_type == "Actual":
# distribute the tax amount proportionally to each item row
actual = flt(tax.tax_amount, tax.precision("tax_amount"))
current_tax_amount = item.net_amount * actual / self.doc.net_total if self.doc.net_total else 0.0
if tax.get("is_tax_withholding_account") and item.meta.get_field("apply_tds"):
if not item.get("apply_tds") or not self.doc.tax_withholding_net_total:
current_tax_amount = 0.0
else:
current_tax_amount = item.net_amount * actual / self.doc.tax_withholding_net_total
else:
current_tax_amount = (
item.net_amount * actual / self.doc.net_total if self.doc.net_total else 0.0
)
elif tax.charge_type == "On Net Total":
current_tax_amount = (tax_rate / 100.0) * item.net_amount