← Back to team overview

openerp-india team mailing list archive

[Bug 815398] Re: compute tax always round with account decimal precision

 

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"

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/815398

Title:
  compute tax always round with account decimal precision

Status in OpenERP Addons (modules):
  Confirmed
Status in OpenERP Addons 6.0 series:
  New
Status in OpenERP Addons trunk series:
  Confirmed

Bug description:
  In 6.0.2

  I have define 4 decimal in purchase, 
  Create a purchase, add product with tax (French accounting)
  when tax is compute, the price_unit is roudning with 2 decimal (not 4), the amount taxe is false.

  Regards,

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/815398/+subscriptions