[FIX] account: don't crash when generating an invoice from website_quote

res.currency's `_convert` expects a record not an id.

On res.currency:

_convert() calls
_get_conversion_rate() which calls
_get_rates()

_get_rates does company.id.
This commit is contained in:
Joren Van Onder
2018-06-28 18:47:57 +02:00
committed by Romain Derie
parent 2362ea09f8
commit 0ea864ca90
+2 -1
View File
@@ -1193,7 +1193,8 @@ class AccountMoveLine(models.Model):
amount_currency = False
currency_id = False
date = self.env.context.get('date') or fields.Date.today()
company = self.env.context.get('company_id', self.env.user.company_id)
company = self.env.context.get('company_id')
company = self.env['res.company'].browse(company) if company else self.env.user.company_id
if src_currency and src_currency != company_currency:
amount_currency = amount
amount = src_currency._convert(amount, company_currency, company, date)