fix(UAE): Incorrect VAT rate display in Sales Invoice (#21882)

This commit is contained in:
Deepesh Garg 2020-05-26 18:02:21 +05:30 committed by GitHub
parent 752ca63fea
commit 5fa207f020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt
from erpnext.controllers.taxes_and_totals import get_itemised_tax
from six import iteritems
def update_itemised_tax_data(doc):
if not doc.taxes: return
@ -9,7 +11,14 @@ def update_itemised_tax_data(doc):
for row in doc.items:
tax_rate = 0.0
if itemised_tax.get(row.item_code):
item_tax_rate = frappe.parse_json(row.item_tax_rate)
# First check if tax rate is present
# If not then look up in item_wise_tax_detail
if item_tax_rate:
for account, rate in iteritems(item_tax_rate):
tax_rate += rate
elif 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"))