mirror of
https://github.com/NaN-tic/trytond-account_invoice_company_currency.git
synced 2023-12-14 02:52:54 +01:00
parent
31e2d12281
commit
a50679de0f
16
invoice.py
16
invoice.py
|
@ -264,10 +264,14 @@ class InvoiceLine(metaclass=PoolMeta):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Date = pool.get('ir.date')
|
Date = pool.get('ir.date')
|
||||||
Currency = pool.get('currency.currency')
|
Currency = pool.get('currency.currency')
|
||||||
if self.invoice.currency == self.invoice.company.currency:
|
|
||||||
|
currency = self.invoice and self.invoice.currency or self.currency
|
||||||
|
currency_date = self.invoice and self.invoice.currency_date or Date.today()
|
||||||
|
company = self.invoice.company or self.company
|
||||||
|
|
||||||
|
if currency == company.currency:
|
||||||
return self.amount
|
return self.amount
|
||||||
with Transaction().set_context(date=self.invoice.currency_date
|
|
||||||
or Date.today()):
|
with Transaction().set_context(date=currency_date):
|
||||||
return Currency.compute(self.invoice.currency,
|
return Currency.compute(currency, self.amount, company.currency,
|
||||||
self.amount,
|
round=True)
|
||||||
self.invoice.company.currency, round=True)
|
|
||||||
|
|
Loading…
Reference in a new issue