feat: item wise tds calculation

This commit is contained in:
niralisatapara
2022-11-02 12:19:51 +05:30
parent 4aff2a32ad
commit 2ca0cf6fc4
8 changed files with 107 additions and 123 deletions

View File

@@ -67,13 +67,15 @@ class calculate_taxes_and_totals(object):
def calculate_tax_withholding_net_total(self):
if hasattr(self.doc, "tax_withholding_net_total"):
sum_net_amount = 0
sum_base_net_amount = 0
for item in self.doc.get("items"):
if hasattr(item, "apply_tds") and item.apply_tds:
sum_net_amount += item.net_amount
sum_base_net_amount += item.base_net_amount
self.doc.tax_withholding_net_total = sum_net_amount
self.doc.base_tax_withholding_net_total = sum_base_net_amount
def validate_item_tax_template(self):
for item in self.doc.get("items"):
@@ -1076,4 +1078,4 @@ class init_landed_taxes_and_totals(object):
def set_amounts_in_company_currency(self):
for d in self.doc.get(self.tax_field):
d.amount = flt(d.amount, d.precision("amount"))
d.base_amount = flt(d.amount * flt(d.exchange_rate), d.precision("base_amount"))
d.base_amount = flt(d.amount * flt(d.exchange_rate), d.precision("base_amount"))