From 61c282a4c4d5f602d921a7c8b2efa3db2480230e Mon Sep 17 00:00:00 2001 From: "Achraf (abz)" Date: Thu, 15 Oct 2020 13:35:16 +0000 Subject: [PATCH] [FIX] base: Creating new currency raise traceback Issue - Install 'Accounting' - Go to 'Settings/Accounting' - Try to create new currency Cause The empty tuple of ids raise sql syntax error. Solution Init the currency rate to 0.0 when there are not ids opw-2359632 closes odoo/odoo#60159 X-original-commit: 24ab21811ef71f75a24fdeb441c299435789e8fb Signed-off-by: Nicolas Martinelli (nim) Signed-off-by: Achraf --- odoo/addons/base/models/res_currency.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odoo/addons/base/models/res_currency.py b/odoo/addons/base/models/res_currency.py index be2f50b7fb5..7eddd52972e 100644 --- a/odoo/addons/base/models/res_currency.py +++ b/odoo/addons/base/models/res_currency.py @@ -46,6 +46,8 @@ class Currency(models.Model): ] def _get_rates(self, company, date): + if not self.ids: + return {} self.env['res.currency.rate'].flush(['rate', 'currency_id', 'company_id', 'name']) query = """SELECT c.id, COALESCE((SELECT r.rate FROM res_currency_rate r