-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Bug
In France, when a gift card is sold and can be used later for different products with different VAT rates, the gift card bears no VAT (VAT rate = 0%). As a consequence:
When a customer pays an invoice with a Gift Card, the invoice looks like :
- HT amount = -10€
- VAT amount= +10€
- TTC amount= 0€
If the transaction is cancelled, the corresponding credit note would be:
- HT amount = +10€
- VAT amount= -10€
- TTC amount= 0€
The ErrorInvoiceAvoirMustBeNegative is triggered and we cannot proceed whith the credit note.
A possible solution would be to execute the test on total_ttc instead of total_ht:
// We check invoice sign
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
// If a credit note, the sign must be negative
** #if ($object->total_ttc > 0) {**
setEventMessages($langs->trans("ErrorInvoiceAvoirMustBeNegative"), null, 'errors');
$action = '';
}
this is a similar request as #23548 but in a slightly different context
Dolibarr Version
20.0.4
Environment PHP
7.4.33
Environment Database
MariaDB 8.0.43-34
Steps to reproduce the behavior and expected behavior
- create an invoice with
- one product with a VAT rate of 20%, a HT price of 50€ and TTC price of 60€
- one product (to mimick the usage of a 60€ gift card without VAT) with a VAT rate of 0% and a HT price = TTC price = 60€
=> total_ht = -10€, VAT = +10€ and total_ttc = 0€
- cancel this invoice by a creating a credit note with the same lines
=> total_ht = +10€, VAT = -10€ and total_ttc = 0€
This credit note can't be validated as the test is ran on the total_ht : you get the error message
If the test were ran on total_ttc, it would pass and work
Attached files
No response