parent_contract_id field in hr.contract
parent
05f554ff53
commit
6efa742956
@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
class Contract(models.Model):
|
||||
_inherit = "hr.contract"
|
||||
|
||||
parent_contract_id = fields.Many2one("hr.contract", string="Contrat parent (en cas d'avenant)")
|
||||
|
||||
classification_group = fields.Selection(selection='_get_groups_selection', string="Groupe associé au coefficient")
|
||||
indice = fields.Integer(string="indice du salaire négocié (nombre de points)")
|
||||
updated_wage = fields.Integer(string="Salaire actualisé", compute='_get_updated_wage', readonly=True, store=True)
|
||||
|
||||
@api.model
|
||||
def _get_groups_selection(self):
|
||||
if self.env.user.company_id.cc and self.env.user.company_id.cc.groups:
|
||||
groups_list = [(group.strip(), group.strip()) for group in self.env.user.company_id.cc.groups.split(';')]
|
||||
return groups_list
|
||||
else:
|
||||
return []
|
||||
|
||||
@api.depends('indice', 'classification_group')
|
||||
def _get_updated_wage(self):
|
||||
employee = self.env.context.get('employee', self.env.user)
|
||||
cc = employee.company_id.cc
|
||||
if cc and cc.idcc == "3442":
|
||||
group_coeff = cc.actual_coeffs.filtered(lambda r: r.group == employee.contract_id.classification_group).ensure_one()['coeff_min']
|
||||
if group_coeff > employee.contract_id.indice:
|
||||
raise UserError("L'indice minimum conventionnel pour le poste est %s, veuillez ajuster l'indice du contract en conséquence.", group_coeff)
|
Loading…
Reference in New Issue