brotherton-erpnext/erpnext/regional/united_arab_emirates/utils.py
rohitwaghchaure d45266881a [Enhance] New print format for UAE/KSA for vat/excise (#12202)
* [Enhance] New print format for UAE/KSA for vat/excise

* Fixed spelling
2017-12-28 14:20:13 +05:30

14 lines
559 B
Python

from frappe.utils import flt
from erpnext.controllers.taxes_and_totals import get_itemised_tax
def update_itemised_tax_data(doc):
if not doc.taxes: return
itemised_tax = get_itemised_tax(doc.taxes)
for row in doc.items:
tax_rate = sum([tax.get('tax_rate', 0) for d, tax in itemised_tax.get(row.item_code).items()])
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.total_amount = flt((row.net_amount + row.tax_amount), row.precision("total_amount"))