[FIX] account: corrected tax base amount calculation
authorAlexis de Lattre <>
Wed, 3 Oct 2012 10:39:19 +0000 (16:09 +0530)
committerRifakat <rha@tinyerp.com>
Wed, 3 Oct 2012 10:39:19 +0000 (16:09 +0530)
It first rounds base value and then multiplies with the qty which leads to wrong calculation

lp bug: https://launchpad.net/bugs/1058390 fixed

bzr revid: rha@tinyerp.com-20121003103919-slne7ppo75k9478m

addons/account/account_invoice.py

index 503e144..f42403f 100644 (file)
@@ -1586,14 +1586,13 @@ class account_invoice_tax(osv.osv):
 
         for line in inv.invoice_line:
             for tax in tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, (line.price_unit* (1-(line.discount or 0.0)/100.0)), line.quantity, inv.address_invoice_id.id, line.product_id, inv.partner_id)['taxes']:
-                tax['price_unit'] = cur_obj.round(cr, uid, cur, tax['price_unit'])
                 val={}
                 val['invoice_id'] = inv.id
                 val['name'] = tax['name']
                 val['amount'] = tax['amount']
                 val['manual'] = False
                 val['sequence'] = tax['sequence']
-                val['base'] = tax['price_unit'] * line['quantity']
+                val['base'] = cur_obj.round(cr, uid, cur, tax['price_unit'] * line['quantity'])
 
                 if inv.type in ('out_invoice','in_invoice'):
                     val['base_code_id'] = tax['base_code_id']