-
- Downloads
[FIX] account: avoid multiplying rounding error on unit price.
Do not round the unit price when calculating the company currency price used to calculate the tax. This avoids rounding errors when the company currency amount has been calculated based on a converted (and rounded) unit price. Corrects a regression bug introduced in 13.0. The behavior has been corrected in 14.0 by a more extensive rework of the accounting module (commit id 419d4bbe among others). This fix seeks to correct the bug with minimal impact. In version 12.0, the tax amount was calculated strictly based on the total amount, which avoided compounding the rounding issue but had some other problems (see https://github.com/odoo/odoo/issues/35358 ). In version 14.0, the problem does not exist. This commit only includes the unit test. Current behavior before PR: For example: 20000 @ 2.82 with a rate of 1.1726 gives a tax amount in foreign currency of 11844, which is 10100 in company currency. But if the company currency amount is calculated based on a unit price of 2.4 (rounded converted amount of 2.82), the calculated tax amount will only be 10080 in company currency. Desired behavior after PR is merged: Tax amount is calculated based on the total amount in the foreign currency, not the amount based on the rounded unit price. opw-2340933 closes odoo/odoo#59365 X-original-commit: 14c86a02 Signed-off-by:Nicolas Martinelli (nim) <nim@odoo.com> Signed-off-by:
Nicolas Galler <nicocrm@users.noreply.github.com>
Please register or sign in to comment