Skip to content

Commit 336f820

Browse files
author
Dolicraft
committed
Fix Dolibarr#35649 allow credit note with positive HT when TTC is zero or negative
The validation guard refused a credit note as soon as total_ht was strictly positive, which blocked legitimate refunds of an invoice mixing a positive VAT line with a 0% VAT gift-card line (HT=+10, VAT=-10, TTC=0). Check total_ttc instead, mirroring the symmetric guard for non credit-note invoices a few lines below, and keep the existing error message. Signed-off-by: Dolicraft <contact@dolicraft.com>
1 parent 13f21da commit 336f820

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

htdocs/compta/facture/card.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@
411411
// We check invoice sign
412412
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
413413
// If a credit note, the sign must be negative
414-
if ($object->total_ht > 0) {
414+
// Note: total_ht can be positive when total_ttc is 0 or negative (mirror of the
415+
// invoice case below), e.g. a refund of a 0 VAT gift card line cancelling a VAT line.
416+
if ($object->total_ttc > 0) {
415417
setEventMessages($langs->trans("ErrorInvoiceAvoirMustBeNegative"), null, 'errors');
416418
$action = '';
417419
}

0 commit comments

Comments
 (0)