fix: incorrect value of ImponibileImporto in the xml invoice (#18655)
This commit is contained in:
committed by
Nabin Hait
parent
4a6b5367ca
commit
eb174e1afa
@@ -129,6 +129,8 @@ def download_zip(files, output_filename):
|
|||||||
|
|
||||||
def get_invoice_summary(items, taxes):
|
def get_invoice_summary(items, taxes):
|
||||||
summary_data = frappe._dict()
|
summary_data = frappe._dict()
|
||||||
|
|
||||||
|
applied_tax_row_ids = []
|
||||||
for tax in taxes:
|
for tax in taxes:
|
||||||
#Include only VAT charges.
|
#Include only VAT charges.
|
||||||
if tax.charge_type == "Actual":
|
if tax.charge_type == "Actual":
|
||||||
@@ -153,7 +155,9 @@ def get_invoice_summary(items, taxes):
|
|||||||
net_amount=reference_row.tax_amount,
|
net_amount=reference_row.tax_amount,
|
||||||
taxable_amount=reference_row.tax_amount,
|
taxable_amount=reference_row.tax_amount,
|
||||||
item_tax_rate={tax.account_head: tax.rate},
|
item_tax_rate={tax.account_head: tax.rate},
|
||||||
charges=True
|
charges=True,
|
||||||
|
type="Actual",
|
||||||
|
tax_row_name=tax.name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -165,13 +169,21 @@ def get_invoice_summary(items, taxes):
|
|||||||
item_tax_rate = json.loads(item.item_tax_rate)
|
item_tax_rate = json.loads(item.item_tax_rate)
|
||||||
|
|
||||||
if item_tax_rate and tax.account_head in item_tax_rate:
|
if item_tax_rate and tax.account_head in item_tax_rate:
|
||||||
|
if (item.get("tax_row_name")
|
||||||
|
and item.get("tax_row_name") in applied_tax_row_ids):
|
||||||
|
continue
|
||||||
|
|
||||||
key = cstr(item_tax_rate[tax.account_head])
|
key = cstr(item_tax_rate[tax.account_head])
|
||||||
if key not in summary_data:
|
if key not in summary_data:
|
||||||
summary_data.setdefault(key, {"tax_amount": 0.0, "taxable_amount": 0.0,
|
summary_data.setdefault(key, {"tax_amount": 0.0, "taxable_amount": 0.0,
|
||||||
"tax_exemption_reason": "", "tax_exemption_law": ""})
|
"tax_exemption_reason": "", "tax_exemption_law": ""})
|
||||||
|
|
||||||
|
if item.get("type") and item.get("type") == "Actual":
|
||||||
|
applied_tax_row_ids.append(item.get("tax_row_name"))
|
||||||
|
|
||||||
summary_data[key]["tax_amount"] += item.tax_amount
|
summary_data[key]["tax_amount"] += item.tax_amount
|
||||||
summary_data[key]["taxable_amount"] += item.net_amount
|
summary_data[key]["taxable_amount"] += item.net_amount
|
||||||
|
|
||||||
if key == "0.0":
|
if key == "0.0":
|
||||||
summary_data[key]["tax_exemption_reason"] = tax.tax_exemption_reason
|
summary_data[key]["tax_exemption_reason"] = tax.tax_exemption_reason
|
||||||
summary_data[key]["tax_exemption_law"] = tax.tax_exemption_law
|
summary_data[key]["tax_exemption_law"] = tax.tax_exemption_law
|
||||||
|
|||||||
Reference in New Issue
Block a user