From c10064ae2c4e5b33be6bcd5d8658ae3ae5ef8fab Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 23 Sep 2019 17:39:55 +0530 Subject: [PATCH] fix: ImponibileImporto not getting calculated properly --- erpnext/regional/italy/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py index 12f5762f44..bc8d00d8b8 100644 --- a/erpnext/regional/italy/utils.py +++ b/erpnext/regional/italy/utils.py @@ -151,8 +151,7 @@ def get_invoice_summary(items, taxes): tax_rate=tax.rate, tax_amount=(reference_row.tax_amount * tax.rate) / 100, net_amount=reference_row.tax_amount, - taxable_amount=(reference_row.tax_amount if tax.charge_type == 'On Previous Row Amount' - else reference_row.total), + taxable_amount=reference_row.tax_amount, item_tax_rate={tax.account_head: tax.rate}, charges=True ) @@ -177,6 +176,10 @@ def get_invoice_summary(items, taxes): summary_data[key]["tax_exemption_reason"] = tax.tax_exemption_reason summary_data[key]["tax_exemption_law"] = tax.tax_exemption_law + if summary_data.get("0.0") and tax.charge_type in ["On Previous Row Total", + "On Previous Row Amount"]: + summary_data[key]["taxable_amount"] = tax.total + if summary_data == {}: #Implies that Zero VAT has not been set on any item. summary_data.setdefault("0.0", {"tax_amount": 0.0, "taxable_amount": tax.total, "tax_exemption_reason": tax.tax_exemption_reason, "tax_exemption_law": tax.tax_exemption_law})