[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
This commit is contained in:
RomainLibert
2018-12-31 14:20:29 +00:00
parent c0104303c6
commit 6d02b7c2e9
+3 -3
View File
@@ -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