Wrong base amount of taxes in OpenERP 6.1

Bug #1058390 reported by Alexis de Lattre
38
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Undecided
OpenERP Publisher's Warranty Team
Therp Backports (Deprecated)
Status tracked in Addons-6.1
Addons-6.1
Fix Released
High
Ronald Portier (Therp)

Bug Description

Anevia has discovered that OpenERP 6.1 doesn't compute correctly the "base" amount of taxes ; as surprising as it may seem, the tax amount is correct.

This bug is present in OpenERP 6.1 (not in OpenERP 6.0) with an up-to-date codebase.

Here is a detailed scenario to reproduce the bug :
1. Create a new DB with demo data
2. Install the module "account_accountant"
3. Activate "Extended view"
4. Create a new customer invoice for the partner Agrolait in EUR currency
   Add an invoice line with :
   - Product = HDD1 (could be any)
   - Quantity = 100
   - Unit price = 0.56
   - Discount = 15%
  (if you have a tax, check that it's NOT a "tax included" one)
5. Click on compute tax : you will see that :
  * The total untaxed amount of the invoice is 47.60
  * At the bottom left, in the invoice tax lines, there is one line ; in this line, the "base" amount is 48.00 !
  => These two amounts should be identical ; that's the bug.

The cause of the bug is the following :
* the "price_subtotal" of the invoice line is computed that way :
  1. (quantity * unit price) * (1-discount/100) = 47.60000 (cf line 1272 of account_invoice.py)
  2. Round at the precision of the EUR currency = 47.60 (cf line 1277 of account_invoice.py)

* but the "base" amount of the invoice tax line is not computed the same way :
  1. price_unit * (1-discount / 100) = 0.47600 (cf line 1588 of account_invoice.py)
  2. Round at the precision of the EUR currency = 0.48 (cf line 1589 of account_invoice.py)
  3. Multiply by the quantity : 0.48 x 100 = 48.0 (cf line 1596 of account_invoice.py)

I have written a patch that makes OpenERP compute the "base" amount of invoice tax lines with the same method as the "price_subtotal" of the invoice line. I enclose the patch to this bug report.

In fact, this bug was introduced in the branch addons-6.1 by the commit 5569 dated 2011-11-10, cf http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/revision/5569. This commit was designed to fix this bug : https://launchpad.net/bugs/887367. I have tested the scenario of this bug report to see if my code re-introduces this bug ; it's not the case.

Tags: maintenance

Related branches

Revision history for this message
Alexis de Lattre (alexis-via) wrote :
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

merged in trunk.
Thanks for the very good contribution :)

Changed in openobject-addons:
status: New → Fix Released
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

r7646

Changed in openobject-addons:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
Revision history for this message
invitu (invitu) wrote :

It does not seem to be merged in lp:openobject-addons/6.1

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

I confirm that the fix is NOT MERGED in addons/6.1. The status "Merged" on the merge proposal is WRONG !

Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) wrote :

Hi,
This is yet to merge with 6.1, we will do it soon.

Thanks,
Rifakat Haradwala

Changed in therp-backports:
assignee: nobody → Ronald Portier (Therp) (rportier1962)
importance: Undecided → High
Revision history for this message
Manu (manu-tiedra) wrote :

I'm amazed this has not been merged yet.

A customer called us pointing out the bug after having sent more than 400 invoices with invalid data...

Revision history for this message
cubells (cubells) wrote :

Why has this patch not been merged yet?

It's a serious bug because the tax base of the invoices is wrong calculated.

Please merge now!

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

The bug is still not fixed in the official addons/6.1 branch.

But the bug is fixed in the "OCB 6.1" branch (OCB = OpenERP Community Backport) :
lp:ocb-addons/6.1

To get more info about the OCB branches, read https://launchpad.net/ocb-addons

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.