[FIX] account: fix TypeError for currency in journal items
If applied, this commit will solve the issue of unsupported operand type in journal item(s) when currency is not set. Steps to produce: - Accounting > Journal Entries > Create new entry. - Add a line in Journal Items and remove the currency from that line. - Save > Error will be generated. Fix this issue by calling the compute of the currency when the currency is not available. sentry - 4069681536 closes odoo/odoo#125661 X-original-commit: 7163134b397e113c10936af908bdfebef2336d67 Signed-off-by: Florian Gilbert (flg) <flg@odoo.com> Signed-off-by: Parth Solanki (paso) <paso@odoo.com>
This commit is contained in:
@@ -634,12 +634,15 @@ class AccountMoveLine(models.Model):
|
||||
date=date,
|
||||
)
|
||||
for line in self:
|
||||
line.currency_rate = get_rate(
|
||||
from_currency=line.company_currency_id,
|
||||
to_currency=line.currency_id,
|
||||
company=line.company_id,
|
||||
date=line.move_id.invoice_date or line.move_id.date or fields.Date.context_today(line),
|
||||
)
|
||||
if line.currency_id:
|
||||
line.currency_rate = get_rate(
|
||||
from_currency=line.company_currency_id,
|
||||
to_currency=line.currency_id,
|
||||
company=line.company_id,
|
||||
date=line.move_id.invoice_date or line.move_id.date or fields.Date.context_today(line),
|
||||
)
|
||||
else:
|
||||
line.currency_rate = 1
|
||||
|
||||
@api.depends('currency_id', 'company_currency_id')
|
||||
def _compute_same_currency(self):
|
||||
|
||||
Reference in New Issue
Block a user