bzr revid: fp@tinyerp.com-20090118233503-cuu9w0iv999ic8xa
This commit is contained in:
Fabien Pinckaers 2009-01-19 00:35:03 +01:00
parent 4c48fa853a
commit 5a016ca293
1 changed files with 4 additions and 6 deletions

View File

@ -1230,8 +1230,8 @@ class account_tax(osv.osv):
'sequence': fields.integer('Sequence', required=True, help="The sequence field is used to order the taxes lines from the lowest sequences to the higher ones. The order is important if you have a tax that have several tax childs. In this case, the evaluation order is important."),
'amount': fields.float('Amount', required=True, digits=(14,4)),
'active': fields.boolean('Active'),
'type': fields.selection( [('percent','Percent'), ('fixed','Fixed'), ('none','None'), ('code','Python Code'),('balance','Balance')], 'Tax Type', required=True,
help="The computation method for the tax amount. Balance can be used on child taxes only."),
'type': fields.selection( [('percent','Percent'), ('fixed','Fixed'), ('none','None'), ('code','Python Code')], 'Tax Type', required=True,
help="The computation method for the tax amount."),
'applicable_type': fields.selection( [('true','True'), ('code','Python Code')], 'Applicable Type', required=True,
help="If not applicable (computed through a Python code), the tax do not appears on the invoice."),
'domain':fields.char('Domain', size=32, help="This field is only used if you develop your own module allowing developpers to create specific taxes in a custom domain."),
@ -1346,8 +1346,6 @@ class account_tax(osv.osv):
exec tax.python_compute in localdict
amount = localdict['result']
data['amount'] = amount
elif tax.type=='balance':
data['amount'] = cur_price_unit - reduce(lambda x, y: x+y.get('amount',0.0), res, 0.0)
amount2 = data['amount']
if len(tax.child_ids):
if tax.child_depend:
@ -1371,6 +1369,8 @@ class account_tax(osv.osv):
latest[name+'_code_id'] = False
if tax.include_base_amount:
cur_price_unit+=amount2
for r in res:
print 'result', r['amount'], r['price_unit']
return res
def compute(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None):
@ -1415,8 +1415,6 @@ class account_tax(osv.osv):
localdict = {'price_unit':cur_price_unit, 'address':address, 'product':product, 'partner':partner}
exec tax.python_compute_inv in localdict
amount = localdict['result']
elif tax.type=='balance':
data['amount'] = cur_price_unit - reduce(lambda x, y: x+y.get('amount',0.0), res, 0.0)
if tax.include_base_amount:
cur_price_unit -= amount