From 6d02b7c2e9a67826c0b81bb01a431ba09469620e Mon Sep 17 00:00:00 2001 From: RomainLibert Date: Mon, 31 Dec 2018 14:20:29 +0000 Subject: [PATCH] [FIX] gamification: add space in generated query The generated query in _generate_goals_from_challenge lacked spaces between the date clause, which caused a traceback. The traceback only appears since v12 and above, because the dates are now casted as dates (::date) in SQL, which has to be followed by a space. Before that it was "fine" as SQL does allow you to write g.start_date = '10-10-2017'and g.end_date = '11-11-2017' Closes #28773 closes odoo/odoo#29836 --- addons/gamification/models/challenge.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py index fc18220eae4..1237a990e40 100644 --- a/addons/gamification/models/challenge.py +++ b/addons/gamification/models/challenge.py @@ -344,12 +344,12 @@ class Challenge(models.Model): date_clause = "" query_params = [line.id] if start_date: - date_clause += "AND g.start_date = %s" + date_clause += " AND g.start_date = %s" query_params.append(start_date) if end_date: - date_clause += "AND g.end_date = %s" + date_clause += " AND g.end_date = %s" query_params.append(end_date) - + query = """SELECT u.id AS user_id FROM res_users u LEFT JOIN gamification_goal g