[FIX] account: wrong tax amount for manual tax line

On an invoice, tax lines are generated in tax_line field. When modifying
manually the tax amount, the recomputed tax_amount field was incorrect in
multicurrency environment, leading to an entry with different tax amount and
debit value.
opw 611474
This commit is contained in:
Rifakathusen Haradwala 2014-09-05 17:36:52 +05:30 committed by Martin Trigaux
parent 2b7a6e2933
commit 3cae2c5155
1 changed files with 1 additions and 4 deletions

View File

@ -1696,13 +1696,10 @@ class account_invoice_tax(osv.osv):
cur_obj = self.pool.get('res.currency')
company_obj = self.pool.get('res.company')
company_currency = False
factor = 1
if ids:
factor = self.read(cr, uid, ids[0], ['factor_tax'])['factor_tax']
if company_id:
company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0]
if currency_id and company_currency:
amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*factor, context={'date': date_invoice or fields.date.context_today(self, cr, uid)}, round=False)
amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount, context={'date': date_invoice or fields.date.context_today(self, cr, uid)}, round=False)
return {'value': {'tax_amount': amount}}
_order = 'sequence'