[FIX] account: Printing invoices in multi companies/currencies

Steps to reproduce the bug:

- Lets consider two companies C1 in € and C2 in $
- Let's consider two customer invoices I1 in C1 and I2 in C2
- Select these two invoices in the list view of invoies and print it

Bug:

A traceback was raised because the function _convert expects a singleton

opw:2222140

closes odoo/odoo#48323

X-original-commit: b66bcfe96dfdc62a1faa26ccf9c6adfa2b8929a4
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-03-25 10:47:12 +00:00
parent e729af8dd9
commit 36316c5af2
+2 -2
View File
@@ -1337,8 +1337,8 @@ class AccountMove(models.Model):
res[line.tax_line_id.tax_group_id]['amount'] += line.price_subtotal
tax_key_add_base = tuple(move._get_tax_key_for_group_add_base(line))
if tax_key_add_base not in done_taxes:
if line.currency_id != self.company_id.currency_id:
amount = self.company_id.currency_id._convert(line.tax_base_amount, line.currency_id, self.company_id, line.date or fields.Date.today())
if line.currency_id and line.company_currency_id and line.currency_id != line.company_currency_id:
amount = line.company_currency_id._convert(line.tax_base_amount, line.currency_id, line.company_id, line.date or fields.Date.today())
else:
amount = line.tax_base_amount
res[line.tax_line_id.tax_group_id]['base'] += amount