753636a412a694f807475a56155f5bd36c236232
Consider the following situation: 1) Create a company in USD 2) Have an exchange rate of 1 EUR = 2 USD 3) Create a 1/3 tax 4) Make an invoice of one line of 100 EUR on which the tax is applied => In 15.0, this created: - a base line of 200 USD = 100 EUR - a tax line of 66.66 USD = 33.33 EUR => In 16.0, this creates: - a base line of 200 USD = 100 EUR - a tax line of 66.67 USD = 33.33 EUR This is due to the fact 16.0 computes the tax amounts twice: once in domestic currency, and once in foreign currency (while 15.0 computed everything in domestic, rounded, then converted). So, it does 100/3 = 33.33333333, rounding it to 33.33 and 200/3 = 66.6666666, rounded to 66.67. The problem with the way v16 does it is that the ratio amount_currency/balance becomes inaccurate to recompute the exchange rate, due to the increase of the rounding difference (indeed 33.33/66.67=0,499925004 , wich is pretty far from the original 0.5). Because of that, when using a cash basis taxe of 1/3 on the exact same setup as in our example, instead of getting a base of 200, a base of 200.01 is computed on the cash basis entry (and hence used by the reports), even though the rate hasn't changed a bit. To fix that, we now compute the tax amount directly in foreign currency, round it accordingly, and only then, convert it to domestic currency. Doing that, our test scenario gives the following: 200/3 = 66.66666 => rounded to 66.67 => 66.67/2 = 33.335 => rounded to 33.34 The lines become: - a base line of 200 USD = 100 EUR - a tax line of 66.67 USD = 33.34 EUR With this, the tax amount on the invoice is now consistent with the currency rate: 66.67/2 = 33.335, which gets rounded to 33.34. The currency rate computed by the cash basis thus becomes 33.34/66.67 = 0.5001; way closer to the original rate, and not causing a significative enough rounding error to impact the base amount anymore. X-original-commit: 68fe20f612b8da003415a061b18bb0464329dba9 Part-of: odoo/odoo#104564
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%