diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2019-06-20 08:59:30 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2019-06-20 09:00:50 +0000 |
| commit | b59f3e4f99233c3af8f95cd95ee187f11cdb9830 (patch) | |
| tree | 560315ebe66643160377dd33d0b225c72d87299d /addons | |
| parent | cfd5c90652026ae5d693404a1acec452a228da28 (diff) | |
[FIX] account: fallback journal
Commit 6b14ceb22577faec4f introduced a smarter way to find the default
journal based on the currency. However, it missed the fallback if no
journal is found.
opw-2009934
opw-2024204
opw-2011321
closes odoo/odoo#34263
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account_invoice.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 799beaf887a..3320c1ee2e8 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -98,7 +98,10 @@ class AccountInvoice(models.Model): currency_clause = [('currency_id', '=', currency_id)] if currency_id == company_currency_id: currency_clause = ['|', ('currency_id', '=', False)] + currency_clause - return self.env['account.journal'].search(domain + currency_clause, limit=1) + return ( + self.env['account.journal'].search(domain + currency_clause, limit=1) + or self.env['account.journal'].search(domain, limit=1) + ) @api.model def _default_currency(self): |
