fix: Itemised tax rate updation

This commit is contained in:
Deepesh Garg
2022-03-14 17:17:01 +05:30
parent 3cc2e53b08
commit be56efad26

View File

@@ -26,6 +26,9 @@ def update_itemised_tax_data(doc):
elif row.item_code and itemised_tax.get(row.item_code): elif row.item_code and itemised_tax.get(row.item_code):
tax_rate = sum([tax.get('tax_rate', 0) for d, tax in itemised_tax.get(row.item_code).items()]) tax_rate = sum([tax.get('tax_rate', 0) for d, tax in itemised_tax.get(row.item_code).items()])
meta = frappe.get_meta(row.doctype)
if meta.has_field('tax_rate'):
row.tax_rate = flt(tax_rate, row.precision("tax_rate")) row.tax_rate = flt(tax_rate, row.precision("tax_rate"))
row.tax_amount = flt((row.net_amount * tax_rate) / 100, row.precision("net_amount")) row.tax_amount = flt((row.net_amount * tax_rate) / 100, row.precision("net_amount"))
row.total_amount = flt((row.net_amount + row.tax_amount), row.precision("total_amount")) row.total_amount = flt((row.net_amount + row.tax_amount), row.precision("total_amount"))