summaryrefslogtreecommitdiff
path: root/addons/gamification
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2017-08-18 18:43:46 +0200
committerOlivier Dony <odo@openerp.com>2017-08-20 23:25:54 +0200
commit695716efb0f79f9a0e716952b1dcd433d866371a (patch)
tree1b582a3469d12fc716d6252b4f239f0cd40da9e4 /addons/gamification
parent589c0d7e2c3a44adc5d26aac8af08c0d06b97d5a (diff)
[FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have outlived their usefulness, and mostly add noise. All remaining dict.iter*() or dict.view*() must be converted to the normal keys(), values() or items() calls. Whenever the result is likely to be used for more than the scope of a loop, or when the dict needs to be modified during iteration, the calls must be wrapped in a ``list()``, to protect the new P3 semantics. Those cases are very exceptional. Also removed some dead code or improved the API to remove unnecessary conversions.
Diffstat (limited to 'addons/gamification')
-rw-r--r--addons/gamification/models/goal.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py
index 56c447dd9d4..3c062401662 100644
--- a/addons/gamification/models/goal.py
+++ b/addons/gamification/models/goal.py
@@ -262,7 +262,7 @@ class Goal(models.Model):
for goal in self:
goals_by_definition.setdefault(goal.definition_id, []).append(goal)
- for definition, goals in pycompat.items(goals_by_definition):
+ for definition, goals in goals_by_definition.items():
goals_to_write = {}
if definition.computation_mode == 'manually':
for goal in goals:
@@ -307,9 +307,9 @@ class Goal(models.Model):
subqueries.setdefault((start_date, end_date), {}).update({goal.id:safe_eval(definition.batch_user_expression, {'user': goal.user_id})})
# the global query should be split by time periods (especially for recurrent goals)
- for (start_date, end_date), query_goals in pycompat.items(subqueries):
+ for (start_date, end_date), query_goals in subqueries.items():
subquery_domain = list(general_domain)
- subquery_domain.append((field_name, 'in', list(set(pycompat.values(query_goals)))))
+ subquery_domain.append((field_name, 'in', list(set(query_goals.values()))))
if start_date:
subquery_domain.append((field_date_name, '>=', start_date))
if end_date:
@@ -353,7 +353,7 @@ class Goal(models.Model):
goals_to_write.update(goal._get_write_values(new_value))
- for goal, values in pycompat.items(goals_to_write):
+ for goal, values in goals_to_write.items():
if not values:
continue
goal.write(values)