From be56efad262cc8233d7bc462aa08d7f02e35ddcb Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 14 Mar 2022 17:17:01 +0530 Subject: [PATCH] fix: Itemised tax rate updation --- erpnext/regional/united_arab_emirates/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/regional/united_arab_emirates/utils.py b/erpnext/regional/united_arab_emirates/utils.py index f350ec4ec2..bdede846fe 100644 --- a/erpnext/regional/united_arab_emirates/utils.py +++ b/erpnext/regional/united_arab_emirates/utils.py @@ -26,9 +26,12 @@ def update_itemised_tax_data(doc): 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()]) - 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")) + meta = frappe.get_meta(row.doctype) + + if meta.has_field('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.total_amount = flt((row.net_amount + row.tax_amount), row.precision("total_amount")) def get_account_currency(account): """Helper function to get account currency."""