[IMP] hr_skills: ensure Progress is positive
It was possible to have negative Progress on a skill, which doesn't make sense. Here we ensure it's a valid percentage between 0 and 100 inclusive. odoo/upgrade#3238 closes odoo/odoo#84442 Taskid: 2762009 Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
@@ -74,6 +74,10 @@ class SkillLevel(models.Model):
|
||||
level_progress = fields.Integer(string="Progress", help="Progress from zero knowledge (0%) to fully mastered (100%).")
|
||||
default_level = fields.Boolean(help="If checked, this level will be the default one selected when choosing this skill.")
|
||||
|
||||
_sql_constraints = [
|
||||
('check_level_progress', 'CHECK(level_progress BETWEEN 0 AND 100)', "Progress should be a number between 0 and 100."),
|
||||
]
|
||||
|
||||
def name_get(self):
|
||||
if not self._context.get('from_skill_level_dropdown'):
|
||||
return super().name_get()
|
||||
|
||||
Reference in New Issue
Block a user