diff options
| author | Andrea Grazioso (agr-odoo) <agr@odoo.com> | 2020-03-25 10:49:57 +0000 |
|---|---|---|
| committer | Andrea Grazioso (agr-odoo) <agr@odoo.com> | 2020-03-26 16:42:14 +0000 |
| commit | cc7d9a6032082fa32949c8cf0bdec2c1f7eb9b6f (patch) | |
| tree | 06e05903dbb7132c82392bdd00da606048a46191 | |
| parent | 873dd735406a967ff0c811afafacb0115eb5dd57 (diff) | |
[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>
| -rw-r--r-- | addons/account/models/account_move.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 9f3c2abacef..c21df95feaa 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -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 |
