[FIX] account: fallback journal

Commit 6b14ceb225 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>
This commit is contained in:
Nicolas Martinelli
2019-06-20 09:00:50 +00:00
parent cfd5c90652
commit b59f3e4f99
+4 -1
View File
@@ -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):