odoo/odoo — pull request #219 by blaggacao (2014-05-26 17:23:38+00:00)
Title: Refactored (not altered) Tax Calculation

This adresses and solves various bugs:
- Sequence is not respected by tin/tax https://github.com/odoo/odoo/issues/197
- tin calculation was inverted deferring sequence order https://github.com/odoo/odoo/issues/198
- Calculation of tin was buggy when tax should be included in base amount of new tax (undiscovered)

I will append screenshots of testing shortly.

`compute_all` now doen't triage for `price_included`any more (fixes #197) but calls the only `compute_unified`, which is responsible - as his former sisterunction - for rounding.

`compute_unifed` calls then `unit_compute_unified` where #198 is solved (no more `taxes.reverse()`). Furthermore this function had to be adapted as to reciev all taxes regardless weather `price_include = True or False`.

This has been done by a distinction on the lowest level just before calculating, as the rest of the logic is purely parallel.

The only exception to that, is the corrections wich have to be made in order to get the right base amount for the next tax. This depends on two things:
- `price_include`
- `include_base_amount` (intrepretation: if true, tax-amount is part of the base of the next tax)

This is why NEW L#2077-2095 do the according (in some cases: temporary) alterations and set a cleanup flag for final clenup and NEW L#2125-2130 does the final cleanup

Thanks for due review and merging into V8.0 as a proper tax calculation is of utmost importance for some mor complicated juristdictions. (Like Colombia)

Please comment, if I can make it even better somehow!

Info: @nhomar