[FIX] hr_expense: computation of tax/base amount
When computing the amount for a tax (included) with children, accumulate the included taxes to avoid taking only the last one (opw 614867).
This commit is contained in:
parent
419c439776
commit
937fb4aa11
|
@ -303,6 +303,7 @@ class hr_expense_expense(osv.osv):
|
||||||
if not taxes:
|
if not taxes:
|
||||||
continue
|
continue
|
||||||
tax_l = []
|
tax_l = []
|
||||||
|
base_tax_amount = line.total_amount
|
||||||
#Calculating tax on the line and creating move?
|
#Calculating tax on the line and creating move?
|
||||||
for tax in tax_obj.compute_all(cr, uid, taxes,
|
for tax in tax_obj.compute_all(cr, uid, taxes,
|
||||||
line.unit_amount ,
|
line.unit_amount ,
|
||||||
|
@ -318,10 +319,10 @@ class hr_expense_expense(osv.osv):
|
||||||
## We need to deduce the price for the tax
|
## We need to deduce the price for the tax
|
||||||
res[-1]['price'] = res[-1]['price'] - (tax['amount'] * tax['base_sign'] or 0.0)
|
res[-1]['price'] = res[-1]['price'] - (tax['amount'] * tax['base_sign'] or 0.0)
|
||||||
# tax amount countains base amount without the tax
|
# tax amount countains base amount without the tax
|
||||||
tax_amount = (line.total_amount - tax['amount']) * tax['base_sign']
|
base_tax_amount = (base_tax_amount - tax['amount']) * tax['base_sign']
|
||||||
else:
|
else:
|
||||||
tax_amount = line.total_amount * tax['base_sign']
|
base_tax_amount = base_tax_amount * tax['base_sign']
|
||||||
res[-1]['tax_amount'] = cur_obj.compute(cr, uid, exp.currency_id.id, company_currency, tax_amount, context={'date': exp.date_confirm})
|
|
||||||
assoc_tax = {
|
assoc_tax = {
|
||||||
'type':'tax',
|
'type':'tax',
|
||||||
'name':tax['name'],
|
'name':tax['name'],
|
||||||
|
@ -333,6 +334,8 @@ class hr_expense_expense(osv.osv):
|
||||||
'tax_amount': tax['amount'] * tax['base_sign'],
|
'tax_amount': tax['amount'] * tax['base_sign'],
|
||||||
}
|
}
|
||||||
tax_l.append(assoc_tax)
|
tax_l.append(assoc_tax)
|
||||||
|
|
||||||
|
res[-1]['tax_amount'] = cur_obj.compute(cr, uid, exp.currency_id.id, company_currency, base_tax_amount, context={'date': exp.date_confirm})
|
||||||
res += tax_l
|
res += tax_l
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue