Comment 2 for bug 815398

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

I am also annoyed by the fact that the "compute_all" function in account/account.py which compute taxes uses the "Account" decimal precision...

For example :
- by default, the 'Account' decimal precision is 2

- this is used in account/account_invoice.py to define the decimal precision of the amount_untaxed, amount_tax, amount_total on invoices and also the 'price_unit' and 'price_subtotal' in invoice lines -> so most companies will want to keep the default value of 2

- by default in OpenERP, the taxes are computed as "sum of rounded line values" and I would like them to be computed as "rounded sum of line values" (in my experience, most companies compute their taxes as "rounded sum of line values"). For that, you would need to have a decimal precision of 5 in the function that calculate taxes. The function that calculate taxes is the function "compute_all" on the object "account_tax" in account/account.py. Unfortunately, this function uses the 'Account' decimal precision, cf the first line of the function :

def compute_all(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None, force_excluded=False):
    precision = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')

Here is the solution that I would suggest (it is fully compatible with Christophe's solution ; it is a complement) :
- define a new decimal precision that would be called "Tax calculation" for example
- use this new decimal precision in the first line of the function "compute_all"