diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-06-06 11:54:35 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-06-06 11:54:35 +0200 |
| commit | 71a50a2214748fec413c5a0f042d0e7172ae6ea9 (patch) | |
| tree | 2e9ee11551350e23923390d9c53baf630b6ed834 /addons/gamification/models | |
| parent | a7621137cb0d75ec545152d5e1d413c9d3548e45 (diff) | |
| parent | 409679866b2ee8352a8cb27460e7332563526924 (diff) | |
[MERGE] forward port branch saas-12.3 up to 409679866b2
Diffstat (limited to 'addons/gamification/models')
| -rw-r--r-- | addons/gamification/models/res_users.py | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/addons/gamification/models/res_users.py b/addons/gamification/models/res_users.py index 6a188f2003a..daa9d4bc1e1 100644 --- a/addons/gamification/models/res_users.py +++ b/addons/gamification/models/res_users.py @@ -3,6 +3,9 @@ from odoo import api, fields, models +import logging + +_logger = logging.getLogger(__name__) class Users(models.Model): _inherit = 'res.users' @@ -18,26 +21,9 @@ class Users(models.Model): @api.depends('karma') def _compute_karma_position(self): - where_query = self._where_calc([]) - self._apply_ir_rules(where_query, 'read') - from_clause, where_clause, where_clause_params = where_query.get_sql() - - query = """ - SELECT sub.id, sub.karma_position - FROM ( - SELECT id, row_number() OVER (ORDER BY res_users.karma DESC) AS karma_position - FROM {from_clause} - WHERE {where_clause} - ) sub - WHERE sub.id IN %s - """.format(from_clause=from_clause, where_clause=where_clause) - - self.env.cr.execute(query, where_clause_params + [tuple(self.ids)]) - - position_map = {item['id']: item['karma_position'] for item in self.env.cr.dictfetchall()} - + _logger.warning("The field karma_position from res.users is deprecated. Don't use it anymore.") for user in self: - user.karma_position = position_map.get(user.id, 0) + user.karma_position = 0 @api.multi @api.depends('badge_ids') |
