Fix on FACTURE_ENABLE_NEGATIVE

This commit is contained in:
Laurent Destailleur 2019-10-17 15:40:02 +02:00
parent 1a419a6eb6
commit 5e12dcc6b1

View File

@ -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 = '';
}