From b59f3e4f99233c3af8f95cd95ee187f11cdb9830 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 20 Jun 2019 08:59:30 +0000 Subject: [PATCH] [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) --- addons/account/models/account_invoice.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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):