Bug Fix: Negative <cbc:TaxAmount> in Credit Notes for ZATCA XML
Hi team,
We recently fixed a bug in our ZATCA e-invoicing integration (ERPNext) where return invoices (credit notes) were generating negative <cbc:TaxAmount> values in the XML.
As per ZATCA requirements, all monetary amounts — including tax values — must remain positive. The credit nature of the document is already represented by the document type (e.g., 381 for credit notes), so the tax amount itself should not be negative.
Fix Summary:
- Ensured
<cbc:TaxAmount>,<cbc:TaxInclusiveAmount>, and other related fields always use positive values. - Adjusted logic to rely on the invoice type to indicate return/credit instead of using negative amounts.
Thanks!