The calculation of taxes in invoices doesnt honor the server switch "--price_accuracy"

Bug #407332 reported by Numérigraphe
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
sme (OpenERP)
Nominated for 5.0 by Numérigraphe
Odoo Server (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

Using the current stable 5.0 branches from LP
If the server instance is started with "--price_accuracy=3", the price accuracy in the rounding of taxes is not precise enough (rounding to 2 digits).
This makes it impossible to validate some invoices, because the resulting accounting moves are not balanced.

The patch proposed by Raphaël Valyi in Bug #328077 is a way to work around this problem, but probably not a solution - the same problem will arise with "--price_accuracy=6"

Yours,
Lionel.

description: updated
summary: - The object account_invoice_tax doesnt honor the server switch "--
+ The calculation of taxes in invoices doesnt honor the server switch "--
price_accuracy"
Changed in openobject-addons:
assignee: nobody → Anup (Open ERP) (ach-openerp)
Changed in openobject-addons:
assignee: Anup (Open ERP) (ach-openerp) → sme(Tiny/Axelor) (sme.tiny.axelor)
sme (OpenERP) (sme-tiny)
Changed in openobject-addons:
status: New → Confirmed
Revision history for this message
Numérigraphe (numerigraphe) wrote :

I addition to this bug, the same problem seems to show up in the class account_payment_term terms too, with the same ill effect of making the invoice unbalanced.
I worked it around it by changing rount(..., 2) to rount(..., 5) but this is not a clean soultion.
Lionel.

    def compute(self, cr, uid, id, value, date_ref=False, context={}):
#...
     if line.value == 'fixed':
                amt = round(line.value_amount, 2)
            elif line.value == 'procent':
                amt = round(value * line.value_amount, 2)
            elif line.value == 'balance':
                amt = round(amount, 2)
#...t

Revision history for this message
Numérigraphe (numerigraphe) wrote :

Here is a patch that should fix this bug, inspired by the fix of Bug #424214 by Jay.
Could you please review it in include it in v5.0 ?

Please note that this does NOT fix the related Bug #328077, for which we could use
"config['price_accuracy']+3" instead of just "config['price_accuracy']".

Lionel.

Revision history for this message
Numérigraphe (numerigraphe) wrote :

Patch proposed, please review

Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Numérigraphe (numerigraphe) wrote :

Now I'm not too sure this is the way to go. I'm going to study the matter a little further...

Revision history for this message
Numérigraphe (numerigraphe) wrote :

I just realized that I encountered this error because I had made mistakes when I altered my database to suite --price-accuracy=3 instead of 2 - I had changed too many fields to decimal(...,3). After fixing my database, I can't reproduce the problem anymore.
So this may not be a bug after all, just optimistic programming - the code counts on the database to round values in some places.
SME you marked this "confirmed", have you been able to reproduce this ? If not, you can mark it invalid.
Lionel.

Changed in openobject-addons:
status: In Progress → Incomplete
Changed in openobject-addons:
status: Incomplete → In Progress
Changed in openobject-addons:
importance: Undecided → Medium
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Lionel,

Fixed on server by revision 1853 <email address hidden>.
Fixed on addons by revision 2414 <email address hidden>.

Kindly check it and notify us.

Thanks.

Changed in openobject-server:
status: New → Confirmed
status: Confirmed → Fix Released
Changed in openobject-addons:
status: In Progress → Fix Released
Revision history for this message
Numérigraphe (numerigraphe) wrote : Re: [Bug 407332] Re: The calculation of taxes in invoices doesnt honor the server switch "--price_accuracy"

Thanks Jay,
I can confirm the problem is fixed on our setup even if I transform all
decimal(16,2) fields to decimal(16,3).
Lionel

Jay (Open ERP) a écrit :
> Hello Lionel,
>
> Fixed on server by revision 1853 <email address hidden>.
> Fixed on addons by revision 2414 <email address hidden>.
>
> Kindly check it and notify us.
>
> Thanks.
>
> ** Changed in: openobject-server
> Status: New => Confirmed
>
> ** Changed in: openobject-server
> Status: Confirmed => Fix Released
>
> ** Changed in: openobject-addons
> Status: In Progress => Fix Released
>
>

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.