From eb62cd2c2b8eba2fceee4f0491a7f9a045de73d5 Mon Sep 17 00:00:00 2001 From: Suganthi Karunanithi Date: Tue, 26 Feb 2019 14:46:48 +0000 Subject: [PATCH] [FIX] gamification: badge auth for badge no error To avoid exception: TypeError: Mixing apples and oranges: gamification.badge() - gamification.badge.user(1,) when rule_auth of a badge is set to `having`. opw-1945440 closes #31436 closes #31595 Signed-off-by: Nicolas Lempereur (nle) --- addons/gamification/models/badge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/gamification/models/badge.py b/addons/gamification/models/badge.py index 58553981ab7..842bd88f673 100644 --- a/addons/gamification/models/badge.py +++ b/addons/gamification/models/badge.py @@ -236,7 +236,7 @@ class GamificationBadge(models.Model): elif self.rule_auth == 'users' and self.env.user not in self.rule_auth_user_ids: return self.USER_NOT_VIP elif self.rule_auth == 'having': - all_user_badges = self.env['gamification.badge.user'].search([('user_id', '=', self.env.uid)]) + all_user_badges = self.env['gamification.badge.user'].search([('user_id', '=', self.env.uid)]).mapped('badge_id') if self.rule_auth_badge_ids - all_user_badges: return self.BADGE_REQUIRED