parent_contract_id field in hr.contract

16-payroll-cc-dev
Florian Roger 7 months ago
parent 05f554ff53
commit 6efa742956

@ -2,4 +2,19 @@
Addons for Odoo 16.
Starting with association loi 1901 chart of accounts.
## List of modules
| Name | Version | Description |
|-------------------------|--------------|----------------------------------------------------------|
| gn_l10n_fr_pcg_asso | 16.0.0.0.3 | French chart of account and fiscal position for NGO's |
| gn_payroll | 16.0.0.0.2 | French payroll configuration, using IDCC3442 |
## ToDo
## gn_payroll
- [] Créer une structure d'avenants au contrat
- [] Déterminer l'ancienneté du salarié
- [] gestion de la valorisation professionnelle

@ -4,4 +4,5 @@
from . import gn_payroll_cc
from . import gn_payroll_company
from . import gn_payroll_employee
from . import gn_payroll_contract
#from . import gn_payroll_payslip

@ -156,23 +156,6 @@ class ConventionCollectiveGroupDescription(models.Model):
criteria = fields.Selection(selection='_get_criterias_selection', required=True, string="Critère de classification")
description = fields.Text(required=True)
is_latest = fields.Boolean(string="Is Latest", compute="_compute_is_latest", store=True)
@api.depends('start_date')
def _compute_is_latest(self):
# Assuming 'group' is a field that identifies the group of the description
Description = self.env['gn_payroll.cc.group.description']
for record in self:
latest = Description.search([
('cc', '=', record.cc.id),
('group', '=', record.group),
('criteria', '=', record.criteria),
], order='start_date desc', limit=1)
record.is_latest = (latest.id == record.id)
_logger.info("Is record description %s Latest ? %s", record.id, record.is_latest)
class ConventionCollectivePointValue(models.Model):
_name = "gn_payroll.cc.point_value"

@ -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…
Cancel
Save