[FIX] account_anglo_saxon: avoid incorrect conversion while creating invoice in different currency than the one of the company (opw 606408).

Without this patch the generated entries would use incorrect currencies. The expected result from move_line_get are prices in the currency of the invoice.

bzr revid: mat@openerp.com-20140416082915-555nhsvi8l0mmyxi
This commit is contained in:
Martin Trigaux 2014-04-16 10:29:15 +02:00
commit 8c8631b233
1 changed files with 2 additions and 0 deletions

View File

@ -118,6 +118,8 @@ class account_invoice_line(osv.osv):
if a == line['account_id'] and i_line.product_id.id == line['product_id']:
uom = i_line.product_id.uos_id or i_line.product_id.uom_id
standard_price = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, i_line.product_id.standard_price, i_line.uos_id.id)
if inv.currency_id.id != company_currency:
standard_price = self.pool.get('res.currency').compute(cr, uid, company_currency, inv.currency_id.id, standard_price, context={'date': inv.date_invoice})
if standard_price != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc:
price_diff = i_line.price_unit - standard_price
line.update({'price':standard_price * line['quantity']})