VAT off by one cent in Dolibarr

The VAT you calculate by hand does not match Dolibarr's, by one cent. Why Dolibarr rounds line by line, the setting that rounds the total, and the second setting, for purchases, that people forget.

Want someone to look at your instance? Diagnosis, fixed price €90.

Versions concerned
Tested on Dolibarr 24.0.3 · purchase setting present in the code of 22.0.5, 23.0.4 and 24.0.3
What was checked (versions, tests, code read)

Tested on 15 November 2026 on a fresh Dolibarr 24.0.3 instance: customer and vendor invoices with three lines at €10.13 excl. VAT and 20% VAT, without the setting, with the sales setting, then with the purchase setting; totals read back from the database; a line added to a draft created before the setting; setting added through the Other Setup page with real clicks. Code read: CommonObject::update_price (core/class/commonobject.class.php) in 24.0.3; purchase setting checked in 22.0.5 and 23.0.4.

You do the maths by hand: total excluding VAT, times the rate, rounded to the cent. Dolibarr shows one cent more, or less. It is not a bug: Dolibarr does not round at the same place as you.

The example

Three lines at €10.13 excl. VAT, VAT at 20%:

Default With the “round the total” setting
VAT line 1 €2.03 €2.03
VAT line 2 €2.03 €2.02
VAT line 3 €2.03 €2.03
Total excl. VAT €30.39 €30.39
Total VAT €6.09 €6.08
Total incl. VAT €36.48 €36.47

These are the amounts read in a Dolibarr 24.0.3.

  • By default, Dolibarr rounds the VAT of each line (10.13 × 20% = 2.026, so €2.03), then adds them up: 2.03 × 3 = €6.09. This is the “total of roundings”.
  • On the total, you get 30.39 × 20% = 6.078, so €6.08. This is the “rounding of the total”.

The more lines, the bigger the gap can get.

The setting to round the total

There is no dedicated screen: it is a setting you add by hand.

  1. Go to Home > Setup > Other Setup.
  2. On the first row of the table, type the name MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND and the value 1.
  3. Click Add.

With this setting, Dolibarr rounds the total, then adjusts the VAT of one line so that the lines add up: in the example, line 2 becomes €2.02. The total excluding VAT does not change.

The trap: purchases have their own setting

This first setting only applies to sales: proposals, orders and customer invoices. In our test, with this setting alone, the vendor invoice stayed at €6.09.

For vendor invoices, orders and proposals, also add, the same way:

MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND_SUPPLIER = 1

The vendor invoice then went to €6.08, like the customer invoice.

The two settings are independent: each one only changes its own documents.

What happens to existing documents

  • A document is not recalculated by itself. In our test, a draft invoice created before the setting kept its total of €6.09.
  • As soon as you edit that draft, for example by adding a line, Dolibarr recalculates the whole document with the new method: with an identical 4th line, the VAT became €8.10 (2.03 + 2.02 + 2.03 + 2.02), that is 40.52 × 20% rounded.

The simplest is to choose the method at the start, before invoicing, and not change it afterwards.

Which method to choose

Dolibarr does not impose one: both methods exist, only the way of rounding changes. If you are unsure for your business, ask your accountant, and use the same method everywhere.

How this was checked

  • Fresh Dolibarr 24.0.3 instance, on 15 November 2026. Customer and vendor invoices with three lines at €10.13 excl. VAT, 20% VAT, created without the setting, with the sales setting, then with the purchase setting; totals read back from the database (table above).
  • Draft created before the setting, then a 4th line added afterwards: full recalculation, €8.10 of VAT.
  • Setting added through Home > Setup > Other Setup with real clicks: “Record saved”.
  • Code read: CommonObject::update_price() in core/class/commonobject.class.php (24.0.3), which picks the sales or the purchase setting depending on the type of document. The purchase setting also exists in the 22.0.5 and 23.0.4 code.

Frequently asked questions

Why is Dolibarr's VAT one cent away from my calculation?

By default Dolibarr calculates and rounds the VAT of each line, then adds up those rounded amounts. If you calculate the VAT on the total excluding VAT, the rounding falls differently, and the gap can reach one cent or more depending on the number of lines.

How do I make Dolibarr calculate VAT on the total?

In Home > Setup > Other Setup, add the setting given in this guide, with the value 1. Dolibarr then rounds the total and adjusts the VAT of one line so that the lines add up. For vendor invoices, orders and proposals you also need a second setting, the purchase one.

Does the setting change my existing invoices?

Not as long as you leave them alone. In our test, a draft created before the setting kept its old total, then the whole document was recalculated with the new method as soon as a line was added.

DolibarrVATtaxroundingone centdifferenceMAIN_ROUNDOFTOTALvendor invoicetotal

Did this guide help you?

A question about this guide, or a step that does not go as expected on your side? Write to support@dolix.fr.