diff options
| author | Aurélien Warnon <awa@odoo.com> | 2019-10-31 10:39:43 +0000 |
|---|---|---|
| committer | Aurélien Warnon <awa@odoo.com> | 2019-11-06 13:01:09 +0000 |
| commit | 2390ef9bcd81f0e5d3a1be24f2b17839c21a2856 (patch) | |
| tree | 2188651c0e9b704b7205f78b482e98628f2ed1ef /addons/gamification/models | |
| parent | 9f3d6e0fcedd4a393f2ecca67f946e916b564712 (diff) | |
[FIX] gamification: adapt _get_next_rank method to always return a recordset
The return type of the _get_next_rank method on the 'res.users' model was inconsistent.
It sometimes returned a recordset, sometimes False.
This commit adapts the method to always return a recordset (which is empty for the previously
'False' case).
This is a preliminary work for the level up animation on website_slides task.
PR #39870
Task#2032649
Diffstat (limited to 'addons/gamification/models')
| -rw-r--r-- | addons/gamification/models/res_users.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/gamification/models/res_users.py b/addons/gamification/models/res_users.py index bcfd815e4d5..f2806ee8531 100644 --- a/addons/gamification/models/res_users.py +++ b/addons/gamification/models/res_users.py @@ -283,7 +283,13 @@ WHERE sub.user_id IN %%s""" % { default value in related views. TDE FIXME in post-12.4: make next_rank_id a non-stored computed field correctly computed """ - return self.next_rank_id or (not self.rank_id and self.env['gamification.karma.rank'].search([], order="karma_min ASC", limit=1)) + + if self.next_rank_id: + return self.next_rank_id + elif not self.rank_id: + return self.env['gamification.karma.rank'].search([], order="karma_min ASC", limit=1) + else: + return self.env['gamification.karma.rank'] def get_gamification_redirection_data(self): """ |
