Why am I getting wrong Montant HT with tax-included
Hi everyone,
I’m having a rounding/precision issue on Sales Invoices when using tax-included pricing with TND (Tunisian Currency) and 19% TVA or 7%TVA.
Setup
- Currency: TND
- TVA: 19%
- Tax configuration:
- Tax 1: 19%, “Is this tax included in basic rate” = YES
- Tax 2: 1.000 TND (timbre fiscal), type = Actual
- Item price:
- Price List Rate (TTC): 79.000 TND per unit
- Quantity: 12
What Dokos/ERPNext shows
On the invoice, Dokos displays:
- PU HT (net_rate):
66.387 - Montant HT (net_amount):
796.639
But (expected Montant HT) 796.644 DT:
66.387 × 12 = 796.644

Am I doing something wrong in my settings/configuration (currency precision, tax setup, “tax included in rate”, etc.) that causes this behavior?
Or is this actually a bug in how ERPNext calculates and rounds net_rate / net_amount when tax is included in the rate
Thanks in advance to anyone who can help or share their experience.