From 272bc40d2ce768931b19c44183a2f351da9ea4f6 Mon Sep 17 00:00:00 2001 From: Florian Gilbert Date: Fri, 11 Sep 2020 12:44:49 +0000 Subject: [PATCH] [FIX] account: fix traceback happened in accounting dashboard For Odoo Fin purpose: When you click on Synchronize Now, you get a traceback. This traceback comes from the "_get_journal_bank_account_balance" method which performs a "self._cr.execute(...)" and a "self._cr.fetchone()". However, it is possible that the orm may invalidate the whole thing in the meantime because other calls are made. This fix corrects this by grouping the "execute" of the "fetchone". closes odoo/odoo#57555 X-original-commit: 7ab664bd8be72add3591895ef058afe7a1a9147e Signed-off-by: Laurent Smet --- addons/account/models/account_journal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_journal.py b/addons/account/models/account_journal.py index 7ac3dc485f4..98493af3e8e 100644 --- a/addons/account/models/account_journal.py +++ b/addons/account/models/account_journal.py @@ -691,11 +691,11 @@ class AccountJournal(models.Model): FROM ''' + tables + ''' WHERE ''' + where_clause + ''' ''' - self._cr.execute(query, where_params) company_currency = self.company_id.currency_id journal_currency = self.currency_id if self.currency_id and self.currency_id != company_currency else False + self._cr.execute(query, where_params) nb_lines, balance, amount_currency = self._cr.fetchone() return amount_currency if journal_currency else balance, nb_lines