Debit and Credit not equal for purchase invoice. Difference is XXX

Hi, I was uploading my purchase invoices and I came across an issue.

When trying to submit, I get this error message:

The strange thing is that it only happens with specific amounts, for example if I enter 11.98 as the price there is no problem, but if I enter 11.97, it gives me an error.
As shown in the image below, the Microsoft Business Standard item has a quantity of 4 and a price of 11.97, and with that amount, ERPNext calculates the exchange rates incorrectly in my currency. In theory, the Total should be equal to the sum of the Net Total and the Tax, but this is not the case.

I already tried to put more decimals, to the fields, exchange rate, and other fields, and the error still showing.

I have been reading the forum and found that many people have encountered this issue, but none have been able to solve it. I don’t think a patch was ever released to fix this tax calculation issue.

Please!
I can pay for someone to solve this bug, i have clients and i cant say to them this is an native error.
Thank you!


Here is another Case, i have many cases like this, for some amounts i have this error.

How ERPNext does the net calculation?

image
+
image

equals to=

image

But it doesnt match. There is a difference. And that difference is always the error amount.

For testing also I created a sale invoice with the same items, and the same amounts, the same taxes, and the calculate are perfect, the problem is only with purchase invoice.

Do you have “Disable Rounded Total” setting checked or unchecked?

I already tried with that check enabled and disabled. The same result, is not a rounding problem, is a bad calculation is doing erpnext in the backend.