From 5e12dcc6b14f51c2766aa9c8d2db63cbf64ea2a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Oct 2019 15:40:02 +0200 Subject: [PATCH] Fix on FACTURE_ENABLE_NEGATIVE --- htdocs/compta/facture/card.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 1b6b4a50e01..cf5d3477527 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -278,8 +278,11 @@ if (empty($reshook)) $action = ''; } } else { - // Si non avoir, le signe doit etre positif - if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0) { + // If not a credit note, amount with tax must be positive or nul. + // Note that amount excluding tax can be negative because you can have a invoice of 100 with vat of 20 that + // consumes a credit note of 100 with vat 0 (total with tax is 0 but without tax is -20). + // For some cases, credit notes can have a vat of 0 (for example when selling goods in France). + if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ttc < 0) { setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors'); $action = ''; }