diff --git a/addons/hr_gamification/models/gamification.py b/addons/hr_gamification/models/gamification.py index 0fc3fcb9440..54443e437b4 100644 --- a/addons/hr_gamification/models/gamification.py +++ b/addons/hr_gamification/models/gamification.py @@ -14,7 +14,8 @@ class GamificationBadgeUser(models.Model): @api.constrains('employee_id') def _check_employee_related_user(self): for badge_user in self: - if badge_user.employee_id not in badge_user.user_id.employee_ids: + if badge_user.employee_id not in badge_user.user_id.\ + with_context(allowed_company_ids=self.env.user.company_ids.ids).employee_ids: raise ValidationError(_('The selected employee does not correspond to the selected user.')) def action_open_badge(self):