from django.db import models
import datamaster_modeles.models as ref
-import rh_v1.models as rh
+import project.rh_v1.models as rh
STATUT_RESIDENCE_CHOICES = (
- ('local', 'local'),
- ('expat', 'expatrié'),
+ ('local', 'Local'),
+ ('expat', 'Expatrié'),
)
POSTE_APPEL_CHOICES = (
- ('interne', 'interne'),
- ('externe', 'externe'),
+ ('interne', 'Interne'),
+ ('externe', 'Externe'),
)
POSTE_STATUT_CHOICES = (
class Poste(models.Model):
- id = models.IntegerField(primary_key=True)
-
# Modèle existant
- id_rh = models.ForeignKey('rh.Poste', null=True)
+ id_rh = models.ForeignKey(rh.Poste, null=True, related_name='+',
+ editable=False)
nom = models.CharField(max_length=255)
- implantation = models.ForeignKey('ref.Implantation')
- type_poste = models.ForeignKey('rh.TypePoste', null=True)
- service = models.ForeignKey('rh.Service')
- responsable = models.ForeignKey('rh.Poste')
- regime_travail = models.DecimalField(max_digit=12, decimal_places=2)
- regime_complet_nb_heure_semaine = models.DecimalField(max_digit=12,
- decimal_places=2)
- regime_travail_nb_heure_semaine = models.DecimalField(max_digit=12,
- decimal_places=2)
+ implantation = models.ForeignKey(ref.Implantation)
+ type_poste = models.ForeignKey(rh.TypePoste, null=True, related_name='+')
+ service = models.ForeignKey(rh.Service, related_name='+')
+ responsable = models.ForeignKey(rh.Poste, related_name='+')
+ regime_travail = models.DecimalField(max_digits=12, decimal_places=2,
+ default=100)
+ regime_travail_nb_heure_semaine = models.DecimalField(max_digits=12,
+ decimal_places=2,
+ default=40)
# Recrutement
- statut_residence = models.CharField(max_length=10,
+ statut_residence = models.CharField(max_length=10, default='MAD',
choices=STATUT_RESIDENCE_CHOICES)
- mise_a_disposition = models.BooleanField(null=True)
- appel = models.CharField(max_length=10, choices=POSTE_APPEL_CHOICES)
+ # TODO null?
+ mise_a_disposition = models.BooleanField()
+ appel = models.CharField(max_length=10, default='interne',
+ choices=POSTE_APPEL_CHOICES)
# Rémunération
- classement_min = models.ForeignKey('rh.Classement')
- classement_max = models.ForeignKey('rh.Classement')
- valeur_point_min = models.ForeignKey('rh.ValeurPoint')
- valeur_point_max = models.ForeignKey('rh.ValeurPoint')
- salaire_min = models.DecimalField(max_digit=12, decimal_places=2)
- salaire_max = models.DecimalField(max_digit=12, decimal_places=2)
- indemn_min = models.DecimalField(max_digit=12, decimal_places=2)
- indemn_max = models.DecimalField(max_digit=12, decimal_places=2)
- autre_min = models.DecimalField(max_digit=12, decimal_places=2)
- autre_max = models.DecimalField(max_digit=12, decimal_places=2)
- postes_similaires = ManyToManyField('Poste')
+ classement_min = models.ForeignKey(rh.Classement, related_name='+')
+ classement_max = models.ForeignKey(rh.Classement, related_name='+')
+ valeur_point_min = models.ForeignKey(rh.ValeurPoint, related_name='+')
+ valeur_point_max = models.ForeignKey(rh.ValeurPoint, related_name='+')
+ salaire_min = models.DecimalField(max_digits=12, decimal_places=2,
+ default=0)
+ salaire_max = models.DecimalField(max_digits=12, decimal_places=2,
+ default=0)
+ indemn_min = models.DecimalField(max_digits=12, decimal_places=2,
+ default=0)
+ indemn_max = models.DecimalField(max_digits=12, decimal_places=2,
+ default=0)
+ autre_min = models.DecimalField(max_digits=12, decimal_places=2,
+ default=0)
+ autre_max = models.DecimalField(max_digits=12, decimal_places=2,
+ default=0)
+
+ # Comparatifs de rémunération
+ devise_comparaison = models.ForeignKey(rh.Devise, related_name='+',
+ null=True, blank=True)
+ comp_locale_min = models.DecimalField(max_digits=12, decimal_places=2,
+ null=True, blank=True)
+ comp_locale_max = models.DecimalField(max_digits=12, decimal_places=2,
+ null=True, blank=True)
+ comp_universite_min = models.DecimalField(max_digits=12, decimal_places=2,
+ null=True, blank=True)
+ comp_universite_max = models.DecimalField(max_digits=12, decimal_places=2,
+ null=True, blank=True)
+ comp_fonctionpub_min = models.DecimalField(max_digits=12, decimal_places=2,
+ null=True, blank=True)
+ comp_fonctionpub_max = models.DecimalField(max_digits=12, decimal_places=2,
+ null=True, blank=True)
+ comp_ong_min = models.DecimalField(max_digits=12, decimal_places=2,
+ null=True, blank=True)
+ comp_ong_max = models.DecimalField(max_digits=12, decimal_places=2,
+ null=True, blank=True)
+ comp_autre_min = models.DecimalField(max_digits=12, decimal_places=2,
+ null=True, blank=True)
+ comp_autre_max = models.DecimalField(max_digits=12, decimal_places=2,
+ null=True, blank=True)
# Méta
- date_creation = models.DateField()
- date_modification = models.DateField(auto_now=True)
+ date_creation = models.DateTimeField(auto_now_add=True)
+ date_modification = models.DateTimeField(auto_now=True)
date_debut = models.DateField()
date_fin = models.DateField(null=True)
- nb_mois = models.TimeField()
actif = models.BooleanField(default=True)
- def save(self, *args, **kwargs):
+ def __unicode__(self):
+ return u'%s - %s (%s)' % (self.implantation, self.type_poste.nom,
+ self.nom)
+
+ def DISABLED_save(self, *args, **kwargs):
# calculate nb_mois = nb of months between date_debut and date_fin
from datetime import date
- delta = self.date_fin - self.date_debut
- nb_mois = delta.months
if not self.salaire_min:
self.salaire_min = self.classement_min * self.valeur_point_min
if not self.salaire_max:
super(Subject, self).save(*args, **kwargs)
-MIN_MAX_CHOICES = (
- ('min', 'minimum'),
- ('max', 'maximum'),
-)
-
-
-TYPE_ORG_CHOICES = (
- ('locale_ent', 'minimum'),
- ('university', 'université'),
- ('government', 'fonction publique'),
- ('ong', 'ONG'),
- ('autre', 'autre'),
+POSTE_FINANCEMENT_CHOICES = (
+ ('A', 'A - Frais de personnel'),
+ ('B', 'B - Projet(s)-Titre(s)'),
+ ('C', 'C - Autre')
)
-class PosteComparatifExterne(models.Model):
- poste = models.ForeignKey('Poste')
- montant = models.DecimalField(max_digit=12, decimal_places=2)
- devise = models.ForeignKey('rh.Devise', default='EUR')
- min_max = models.CharField(max_length=10, choices=MIN_MAX_CHOICES)
- type_org = models.CharField(max_length=10, choices=TYPE_ORG_CHOICES)
-
-
class PosteFinancement(models.Model):
- montant = models.DecimalField(max_digit=12, decimal_places=2)
- poste = models.ForeignKey('Poste')
- pourcentage = models.DecimalField(max_digit=12, decimal_places=2)
+ montant = models.DecimalField(max_digits=12, decimal_places=2)
+ poste = models.ForeignKey('Poste', related_name='financements')
+ type = models.CharField(max_length=1, choices=POSTE_FINANCEMENT_CHOICES)
+ pourcentage = models.DecimalField(max_digits=12, decimal_places=2)
commentaire = models.TextField()
-class PosteFinancementFraisPersonnel(models.Model):
- source = models.ForeignKey('ref.LigneBudgetaire', null=True)
-
-
-class PosteFinancementProjet(models.Model):
- source = models.ForeignKey('ref.Project', null=True)
-
-
-class PosteFinancementAutre(models.Model):
- source = models.TextField()
-
-
GENRE_CHOICES = (
- ('m', 'masculin'),
- ('f', 'féminin'),
+ ('M', 'Homme'),
+ ('F', 'Femme'),
)
id = models.IntegerField(primary_key=True)
# Modèle existant
- id_rh = models.ForeignKey('rh.Employee', null=True)
+ id_rh = models.ForeignKey(rh.Employe, null=True, related_name='+')
nom = models.CharField(max_length=255)
prenom = models.CharField(max_length=255)
- genre = models.CharField(max_length=1,
- choices=GENRE_CHOICES,
- null=True,
- blank=True)
+ genre = models.CharField(max_length=1, choices=GENRE_CHOICES,
+ null=True, blank=True)
COMPTE_COMPTA_CHOICES = (
- ('coda', 'coda'),
- ('scs', 'scs'),
- ('aucun', 'aucun'),
+ ('coda', 'CODA'),
+ ('scs', 'SCS'),
+ ('aucun', 'Aucun'),
)
class Dossier(models.Model):
- statut_anterieur = models.ForeignKey('rh.Statut')
# Modèle existant
- poste = models.ForeignKey('Poste')
- statut = models.ForeignKey('rh.Statut')
- organisme_bstg = models.ForeignKey('rh.OrganismeBstg')
+ employe = models.ForeignKey('Employe', related_name='+')
+ poste = models.ForeignKey('Poste', related_name='+')
+ statut = models.ForeignKey(rh.Statut, related_name='+')
+ organisme_bstg = models.ForeignKey(rh.OrganismeBstg, related_name='+')
+
+ # Données antérieures
+ employe_anterieur = models.ForeignKey('Employe', related_name='+')
+ statut_anterieur = models.ForeignKey(rh.Statut, related_name='+')
+ classement_anterieur = models.ForeignKey(rh.Classement, related_name='+',
+ verbose_name='Classement proposé')
+ salaire_anterieur = models.DecimalField(max_digits=12, decimal_places=2,
+ verbose_name='Salaire de base',
+ null=True, default=None)
# Recrutement
remplacement = models.BooleanField()
- mobilite_interne = models.BooleanField()
statut_residence = models.CharField(max_length=10,
choices=STATUT_RESIDENCE_CHOICES)
# Rémunération
- classement = models.ForeignKey('rh.Classement',
+ classement = models.ForeignKey(rh.Classement, related_name='+',
verbose_name='Classement proposé')
- salaire = models.DecimalField(max_digit=12,
- decimal_places=2,
+ salaire = models.DecimalField(max_digits=12, decimal_places=2,
verbose_name='Salaire de base',
- null=True,
- default=None)
- devise = models.ForeignKey('rh.Devise')
- regime_travail = models.DecimalField(max_digit=12, decimal_places=2)
+ null=True, default=None)
+ devise = models.ForeignKey(rh.Devise, related_name='+')
+ regime_travail = models.DecimalField(max_digits=12, decimal_places=2)
regime_travail_nb_heure_semaine = \
- models.DecimalField(max_digit=12, decimal_places=2)
+ models.DecimalField(max_digits=12, decimal_places=2)
# Contrat
- type_contrat = models.ForeignKey('rh.TypeContrat')
+ type_contrat = models.ForeignKey(rh.TypeContrat, related_name='+')
contrat_date_debut = models.DateField()
contrat_date_fin = models.DateField()
- contrat_nb_mois = models.IntegerField()
# Comptes
compte_compta = models.CharField(max_length=10,
class Remuneration(models.Model):
- #Identification
+ # Identification
id = models.IntegerField(primary_key=True)
dossier = models.ForeignKey('Dossier', db_column='dossier')
type = models.ForeignKey('TypeRemuneration', db_column='type')
- type_revalorisation = models.ForeignKey('TypeRevalorisation',
- db_column='type_revalorisation')
- montant = models.DecimalField(max_digit=12, decimal_places=2)
- devise = models.ForeignKey('rh.Devise',
- to_field='code',
- db_column='devise')
- date_effective = models.DateField()
- pourcentage = models.IntegerField()
-
- #Méta
+ # TODO: what's that?
+ # type_revalorisation = models.ForeignKey('TypeRevalorisation',
+ # db_column='type_revalorisation')
+ montant = models.DecimalField(max_digits=12, decimal_places=2) # Annuel
+ devise = models.ForeignKey(rh.Devise, to_field='code',
+ db_column='devise', related_name='+')
+ date_effective = models.DateField(null=True, blank=True)
+ pourcentage = models.IntegerField(null=True, blank=True)
+
+ # Méta
date_creation = models.DateField(auto_now_add=True)
- user_creation = models.IntegerField()
- desactivation = models.BooleanField()
- date_desactivation = models.DateField()
- user_desactivation = models.IntegerField()
- annule = models.BooleanField()
- date_annule = models.DateField()
- user_annule = models.IntegerField()
+ user_creation = models.IntegerField(null=True, blank=True)
+ desactivation = models.BooleanField(null=True, blank=True)
+ date_desactivation = models.DateField(null=True, blank=True)
+ user_desactivation = models.IntegerField(null=True, blank=True)
+ annule = models.BooleanField(null=True, blank=True)
+ date_annule = models.DateField(null=True, blank=True)
+ user_annule = models.IntegerField(null=True, blank=True)
class JustificationPoste(models.Model):