[account_tax_include] patch to fix coding error

Bug #513240 reported by Alexis de Lattre on 2010-01-27
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released

Bug Description

In the module "account_tax_include" (addons category), we have found a coding mistake which is still present in trunk :
in the file "invoice_tax_incl.py", in the class "account_invoice_line" inside the function "_amount_line2", there is a loop on every invoice line (line 50 : for line in self.browse(cr, uid, ids)), but the two following lines of code (line 88-89) are currently out of the loop :

  res[line.id]['price_subtotal']= round(res[line.id]['price_subtotal'], int(config['price_accuracy']))
  res[line.id]['price_subtotal_incl']= round(res[line.id]['price_subtotal_incl'], int(config['price_accuracy']))

There is no reason why these two lines are currently out of the loop on every invoice line. With the current code, the rounding on price_subtotal and price_subtotal_incl is only made on the last invoice line, and not on the other invoice lines !

The attached patch fixes this, and puts these two lines of code inside the loop on every invoice line. I suggest to apply this patch to the trunk and stable branches.

Alexis de Lattre

Related branches

Alexis de Lattre (alexis-via) wrote :

Fixed by revision 2547 <email address hidden>.
Thank you for pointing out.

Changed in openobject-addons:
status: New → Confirmed
status: Confirmed → Fix Released


I didn't analyse the patch yet, but I can tell you that sale_tax_include and purchase_tax_include from stable extra addons have exactly the same code here.
So is there a point in applying that kind of patch here and not touching those modules?

BTW, I think a fundamental reflexion should be undertaken with sale included in price for 5.2 because that kind of module is far from ideal and easily incompatible with others (because the API is not fined grained) (you in India with account_india are the first impacted with the current limitations; we are heavily impacted in Brazil too). This is being discussed in the accounting expert mailing list here https://launchpad.net/~openerp-expert-accounting I just started a thread, hopefully some coherent direction emerges.

"sale_tax_include" module has been improved from following revision:

4209 <email address hidden>
4284 <email address hidden>.


Thank you vra-openerp.
sorry for late reply. bt these modules need improvemnts.

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

Other bug subscribers