[FIX] account: no recompute when currency_id is unset
When the currency_id is unset from the invoice and account moves are set, by means of updating taxes or the line itself, since there are no checks on the actual presence of a currency, currency methods will invoked causing crashes. Imposing the condition directly on top of the onchange solves the issue. Since the currency_id is a required field for the invoice the recomputation will be triggered again with the correct values. opw-2192628 closes odoo/odoo#48458 X-original-commit: f795b1bc7b42bdcbd4bd9895616461d2702f1e41 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -348,6 +348,8 @@ class AccountMove(models.Model):
|
||||
|
||||
@api.onchange('date', 'currency_id')
|
||||
def _onchange_currency(self):
|
||||
if not self.currency_id:
|
||||
return
|
||||
if self.is_invoice(include_receipts=True):
|
||||
company_currency = self.company_id.currency_id
|
||||
has_foreign_currency = self.currency_id and self.currency_id != company_currency
|
||||
|
||||
Reference in New Issue
Block a user