Monday, June 15, 2026
2 changes · 17.0
Resolved issues and error corrections
This update resolves a validation issue with ZATCA tax reporting caused by how discount quantities were handled in XML generation. The change ensures negative discount quantities are treated like negative unit prices, resulting in accurate totals and preventing validation warnings. This improves the reliability of financial reporting for Saudi Arabia.
Original PR description
Before this commit, using a negative quantity for a discount line caused ZATCA validation warnings (BR-S-08, BR-CO-10 and BR-CO-13), as it was not handled like a negative price. This commit fixes the XML generation to treat negative quantities identically to negative unit prices, ensuring correct totals. task-5883377
This change ensures that fully-discounted product lines in Mexican CFDI invoices are correctly reported to the SAT. Previously, these lines were omitted, causing issues with inventory and tax traceability. Now, the invoice accurately reflects the transaction, aligning with SAT requirements.
Original PR description
Steps to reproduce: - Set up a Mexican company (MXN, l10n_mx_edi) able to send CFDI. - Create a Gift Card / eWallet program (e.g. 680 MXN). - Create a sale order with two products (e.g. 400 and 300).…
Steps to reproduce: - Set up a Mexican company (MXN, l10n_mx_edi) able to send CFDI. - Create a Gift Card / eWallet program (e.g. 680 MXN). - Create a sale order with two products (e.g. 400 and 300). - Apply the gift card so the first product is fully covered. - Deliver, invoice, confirm and send to the SAT. Issue: The product entirely covered by the gift card (net amount = 0) is missing from the generated CFDI. The SAT requires every delivered product to appear in the XML for inventory and tax traceability, so omitting the line makes the document no longer reflect the transaction. The line was dropped because the negative-line dispatching (`_dispatch_negative_lines`) moves a positive line that is fully consumed by a negative one into `nulled_candidate_lines`, and those were never re-added to the CFDI lines. Simply re-adding them is not enough: a fully-discounted line has a tax base of zero, and the SAT rejects a Traslado/Retención with Base = 0 (CFDI40174 / CFDI40181). Fix: Re-add the nulled candidate lines so the concepto is kept with Descuento == Importe, and, when the line net is zero, drop its tax breakdown so it is reported as "No objeto de impuesto" (ObjetoImp '01') without an Impuestos node. This matches the behaviour already present in later versions. opw-6062845