Skip to content

Commit 5c24f18

Browse files
committed
[FIX] hr_gamification: solve runbot error about record assignment
Bug production steps: It shows an error in the runbot build Bug cause: self.env['gamification.goal'].search returns goal ids in an array [ids], but assigning this array to directly employee.goals_ids is giving error because it is O2M field. Bug solution: Assigning in the proper format ([(6, 0, goals.ids)]) instead of just assigning goals.ids. task - 5473086
1 parent 291b26d commit 5c24f18

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

addons/hr_gamification/models/hr_employee.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ class HrEmployee(models.Model):
2121
@api.depends('user_id.goal_ids.challenge_id.challenge_category')
2222
def _compute_employee_goals(self):
2323
for employee in self:
24-
employee.goal_ids = self.env['gamification.goal'].search([
24+
goals = self.env['gamification.goal'].search([
2525
('user_id', '=', employee.user_id.id),
2626
('challenge_id.challenge_category', '=', 'hr'),
2727
])
28+
employee.goal_ids = [(6, 0, goals.ids)]
2829

2930
@api.depends('direct_badge_ids', 'user_id.badge_ids.employee_id')
3031
def _compute_employee_badges(self):

0 commit comments

Comments
 (0)