diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index e39a8c78f2e..8e42d0ec181 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -487,7 +487,7 @@ class AccountInvoice(models.Model): self.date_due = self.date_due or self.date_invoice else: pterm = self.payment_term_id - pterm_list = pterm.compute(value=1, date_ref=date_invoice)[0] + pterm_list = pterm.with_context(currency_id=self.currency_id.id).compute(value=1, date_ref=date_invoice)[0] self.date_due = max(line[0] for line in pterm_list) @api.multi @@ -691,7 +691,7 @@ class AccountInvoice(models.Model): name = inv.name or '/' if inv.payment_term_id: - totlines = inv.with_context(ctx).payment_term_id.compute(total, date_invoice)[0] + totlines = inv.with_context(ctx).payment_term_id.with_context(currency_id=inv.currency_id.id).compute(total, date_invoice)[0] res_amount_currency = total_currency ctx['date'] = date_invoice for i, t in enumerate(totlines): @@ -1227,7 +1227,11 @@ class AccountPaymentTerm(models.Model): date_ref = date_ref or fields.Date.today() amount = value result = [] - prec = self.company_id.currency_id.decimal_places + if self.env.context.get('currency_id'): + currency = self.env['res.currency'].browse(self.env.context['currency_id']) + else: + currency = self.env.user.company_id.currency_id + prec = currency.decimal_places for line in self.line_ids: if line.value == 'fixed': amt = round(line.value_amount, prec)