Skip to content

Error submitting invoice with Item Tax Template #23

@nadarvinod

Description

@nadarvinod

We get below error while submitting invoice with Item Tax Template

Image

cac_TaxCategory = ET.SubElement(cac_TaxSubtotal, "cac:TaxCategory")
raw_item_id_code = sales_invoice_doc.custom_zatca_tax_category
cat_id_val = ET.SubElement(cac_TaxCategory, "cbc:ID")
# cat_id_val.text = str(sales_invoice_doc.custom_zatca_tax_category)
cat_id_val.text = raw_item_id_code.split(":")[0].strip()
# <cbc:Percent>0.00</cbc:Percent><cbc:TaxExemptionReason>NA</cbc:TaxExemptionReason>
prct = ET.SubElement(cac_TaxCategory, "cbc:Percent")
prct.text = str(sales_invoice_doc.taxes[0].rate)
exemption = ET.SubElement(cac_TaxCategory, "cbc:TaxExemptionReason")
if (sales_invoice_doc.custom_zatca_tax_category) == "E":
exemption.text = sales_invoice_doc.custom_exemption_code
else:
exemption.text = "NA"
cac_TaxScheme = ET.SubElement(cac_TaxCategory, "cac:TaxScheme")
taxscheme_id = ET.SubElement(
cac_TaxScheme, "cbc:ID", schemeAgencyID="6", schemeID="UN/ECE 5153"
)
taxscheme_id.text = "OTH"
return invoice
except Exception as e:
frappe.throw(_(f"Error tax total: {str(e)}"))
return None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions