compute tax always round with account decimal precision

Bug #815398 reported by Christophe CHAUVET
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Status tracked in Trunk
6.0
New
Undecided
Unassigned
Trunk
Confirmed
Wishlist
OpenERP R&D Addons Team 2

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,

Related branches

tags: added: account purchase rounding syleam
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

On the branch [1] i have modify the signature to pass another precision and use it if specify

[1] : lp:~syleam/openobject-addons/6.0-bug-815398-cct

in the purchase and sale module, the method to call compute_all must be pass the decimal precision

Regards,

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"

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

I have now sumbitted my merge proposal https://code.launchpad.net/~akretion-team/openobject-addons/trunk-addons-tax-calculation-decimal-precision/+merge/103579

So you can now see exactly the implementation that I propose.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.