19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:00 +01:00
parent a1137a1456
commit e1d89e11e3
2789 changed files with 1093187 additions and 605897 deletions

View file

@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class HrEmployeeBase(models.AbstractModel):
_inherit = "hr.employee.base"
class HrEmployee(models.Model):
_inherit = "hr.employee"
goal_ids = fields.One2many('gamification.goal', string='Employee HR Goals', compute='_compute_employee_goals')
goal_ids = fields.One2many('gamification.goal', string='Employee HR Goals',
compute='_compute_employee_goals', groups="hr.group_hr_user")
badge_ids = fields.One2many(
'gamification.badge.user', string='Employee Badges', compute='_compute_employee_badges',
help="All employee badges, linked to the employee either directly or through the user"
@ -16,7 +16,7 @@ class HrEmployeeBase(models.AbstractModel):
# necessary for correct dependencies of badge_ids and has_badges
direct_badge_ids = fields.One2many(
'gamification.badge.user', 'employee_id',
help="Badges directly linked to the employee")
help="Badges directly linked to the employee", groups="hr.group_hr_user")
@api.depends('user_id.goal_ids.challenge_id.challenge_category')
def _compute_employee_goals(self):
@ -30,9 +30,9 @@ class HrEmployeeBase(models.AbstractModel):
def _compute_employee_badges(self):
for employee in self:
badge_ids = self.env['gamification.badge.user'].search([
'|', ('employee_id', '=', employee.id),
'|', ('employee_id', 'in', employee.ids),
'&', ('employee_id', '=', False),
('user_id', '=', employee.user_id.id)
('user_id', 'in', employee.user_id.ids)
])
employee.has_badges = bool(badge_ids)
employee.badge_ids = badge_ids