[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) <nim@odoo.com>
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
This commit is contained in:
Achraf (abz)
2020-10-16 10:37:21 +00:00
parent 8a22cf8626
commit 61c282a4c4
+2
View File
@@ -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