Version: 8.2.21
Module: axelor-account
Issue:
When creating a tax rate with 3 decimal places (e.g. 9.975%), saving fails with the following exception:
bash
Copier
Modifier
java.lang.ArithmeticException: Rounding necessary
at java.base/java.math.BigDecimal.commonNeedIncrement
at java.base/java.math.BigDecimal.setScale
Cause:
In com.axelor.apps.account.db.TaxLine.getFullName(), the tax rate is formatted using setScale(2) without specifying a RoundingMode. This causes an ArithmeticException whenever the third decimal is non-zero.
Steps to reproduce:
Go to "Taxes" and create a new tax entry.
Set the rate to 9.975.
Save the entry.
Current result:
The system throws an ArithmeticException and the tax is not saved.
Expected result:
The rate should be accepted and displayed correctly (e.g. 9.975%), according to the configured decimal precision in application settings.