diff options
| author | Nicolas Galler <ngl@odoo.com> | 2020-09-29 12:57:38 +0000 |
|---|---|---|
| committer | Nicolas Galler <ngl@odoo.com> | 2020-10-06 10:45:01 +0000 |
| commit | 14c86a020429dfc6b545b65b89cbc7e3828dc557 (patch) | |
| tree | 8b4afc2316dd3caa270317321c18566003e21d8d /addons/mail/static/src/models/thread_cache | |
| parent | ecffbe4060eea98d3444f308bcd28bfb9287e1c3 (diff) | |
[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 419d4bbee04763367fef675a01dc73afa9758b2f 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#59207
X-original-commit: fb4a833ae20c87616b0df481505f53caa2bb4cc0
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread_cache')
0 files changed, 0 insertions, 0 deletions
