1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2010-2010 Camptocamp Austria (<http://www.camptocamp.at>)
7
# Associazione OpenERP Italia (<http://www.openerp-italia.org>)
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU Affero General Public License as
11
# published by the Free Software Foundation, either version 3 of the
12
# License, or (at your option) any later version.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU Affero General Public License for more details.
19
# You should have received a copy of the GNU Affero General Public License
20
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
##############################################################################
24
from osv import fields, osv
25
import decimal_precision as dp
28
class account_tax(osv.osv):
30
_inherit = 'account.tax'
33
'line_precision' : fields.boolean('Rounding Precision', help="Calculates floating point tax per line to simulate vertical calculation"),
37
'line_precision': True
40
def _compute(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None):
41
res = super(account_tax, self)._compute(cr, uid, taxes, price_unit, quantity, address_id, product, partner)
42
tax_pool=self.pool.get('account.tax')
45
tax = tax_pool.browse(cr, uid, r['id'])
46
if tax.line_precision:
47
if r.get('balance',False):
48
r['amount'] = r.get('balance', 0.0) * quantity - total
50
r['amount'] = r.get('amount', 0.0) * quantity