From e9bbd6baafc4147e4b63e888a4c0d77ffcb572ba Mon Sep 17 00:00:00 2001 From: davin baragiotta Date: Wed, 23 Mar 2011 14:15:21 -0400 Subject: [PATCH] rh.models = rh_v1.models --- project/rh/models.py | 292 +++++++++++++++++++++++++++++++++++++++++++++++- project/rh/views.py | 6 +- project/rh_v1/tests.py | 23 ---- project/rh_v1/views.py | 1 - 4 files changed, 296 insertions(+), 26 deletions(-) delete mode 100644 project/rh_v1/tests.py delete mode 100644 project/rh_v1/views.py diff --git a/project/rh/models.py b/project/rh/models.py index 71a8362..2f21e85 100644 --- a/project/rh/models.py +++ b/project/rh/models.py @@ -1,3 +1,293 @@ +# -=- encoding: utf-8 -=- + from django.db import models +from datamaster_modeles.models import Pays, Implantation + +GENRE_CHOICES = ( + ('M', 'Homme'), + ('F', 'Femme'), +) +SITUATION_CHOICES = ( + ('C', 'Célibataire'), + ('F', 'Fiancé'), + ('M', 'Marié'), +) + +class Employe(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + nom = models.CharField(max_length=255) + prenom = models.CharField(max_length=255) + nationalite = models.ForeignKey('datamaster_modeles.Pays', to_field='code', related_name='nationalite', db_column='nationalite') + date_naissance = models.DateField(null=True, blank=True) + #Infos personnelles + genre = models.CharField(max_length=1, choices=GENRE_CHOICES, null=True, blank=True) + situation_famille = models.CharField(max_length=1, choices=SITUATION_CHOICES, null=True, blank=True) + date_entree = models.DateField(null=True, blank=True) #devrait pas être là + #Coordonnées + tel_domicile = models.CharField(max_length=255, null=True, blank=True) + tel_cellulaire = models.CharField(max_length=255, null=True, blank=True) + adresse = models.CharField(max_length=255, null=True, blank=True) + no_rue = models.CharField(max_length=255, null=True, blank=True) + ville = models.CharField(max_length=255, null=True, blank=True) + province = models.CharField(max_length=255, null=True, blank=True) + code_postal = models.CharField(max_length=255, null=True, blank=True) + pays = models.ForeignKey('datamaster_modeles.Pays', to_field='code', null=True, blank=True, related_name='pays', db_column='pays') + #Métas + date_creation = models.DateField(auto_now_add=True) + date_maj = models.DateField(auto_now=True) + commentaire = models.TextField(null=True, blank=True) + +TYPE_DOSSIER_CHOICES = ( + ('2', 'Local'), + ('1', 'Expatrié'), +) + +class Dossier(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + code = models.CharField(max_length=10, unique=True) + employe = models.ForeignKey('Employe', db_column='employe') + #Postes + poste1 = models.ForeignKey('Poste', db_column='poste1', related_name='poste1') + implantation1 = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation1', related_name='implantation1') + complement1 = models.TextField(null=True, blank=True) + responsable_implantation1 = models.IntegerField() + poste2 = models.ForeignKey('Poste', db_column='poste2', related_name='poste2', blank=True, null=True) + implantation2 = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation2', related_name='implantation2') + complement2 = models.TextField(null=True, blank=True) + responsable_implantation2 = models.IntegerField() + #Relations + service = models.ForeignKey('Service', db_column='service') + responsable = models.ForeignKey('Employe', db_column='responsable', related_name='responsable') + remplacement_de = models.ForeignKey('Employe', db_column='remplacement_de', related_name='remplacement_de') + type = models.CharField(max_length=1, choices=TYPE_DOSSIER_CHOICES) + statut = models.ForeignKey('Statut', db_column='statut') + organisme_bstg = models.ForeignKey('OrganismeBstg', db_column='organisme_bstg') + #Rémunération + classement = models.ForeignKey('Classement', db_column='classement') + regime_travail = models.IntegerField() + #Mandat + mandat_date_debut = models.DateField() + mandat_date_fin = models.DateField() + #Contrat + contrat_date_debut = models.DateField() + contrat_date_fin = models.DateField() + type_contrat = models.ForeignKey('TypeContrat', db_column='type_contrat') + #Meta + date_creation = models.DateField(auto_now_add=True) + date_maj = models.DateField(auto_now=True) + commentaire = models.TextField(null=True, blank=True) + +LIEN_PARENTE_CHOICES = ( + ('Conjoint', 'Conjoint'), + ('Conjointe', 'Conjointe'), + ('Fille', 'Fille'), + ('Fils', 'Fils'), +) + +class AyantDroit(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + nom = models.CharField(max_length=255) + prenom = models.CharField(max_length=255) + #Relation + employe = models.ForeignKey('Employe', db_column='employe', related_name='employe') + lien_parente = models.CharField(max_length=10, choices=LIEN_PARENTE_CHOICES, null=True, blank=True) + #Méta + commentaire = models.TextField(null=True, blank=True) + actif = models.BooleanField() + + +class Remuneration(models.Model): + #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.FloatField() + devise = models.ForeignKey('Devise', to_field='code', db_column='devise') + date_effective = models.DateField() + pourcentage = models.IntegerField() + #Méta + date_creation = models.DateField(auto_now_add=True) + user_creation = models.IntegerField() #User ou employé + desactivation = models.BooleanField() # + date_desactivation = models.DateField() + user_desactivation = models.IntegerField() #User ou employé + annule = models.BooleanField() + date_annule = models.DateField() + user_annule = models.IntegerField() #User ou employé + +class FamilleEmploi(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + nom = models.CharField(max_length=255) + #Méta + actif = models.BooleanField() + +class TypePoste(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + nom = models.CharField(max_length=255) + nom_feminin = models.CharField(max_length=255) + description = models.CharField(max_length=255) + is_responsable = models.BooleanField() + famille_emploi = models.ForeignKey('FamilleEmploi', db_column='famille_emploi') + #Méta + date_modification = models.DateField(auto_now=True) + actif = models.BooleanField() + + def __unicode__(self): + return u'%s' % self.nom + + +TYPE_PAIEMENT_CHOICES = ( + ('Régulier', 'Régulier'), + ('Ponctuel', 'Ponctuel'), +) + +NATURE_REMUNERATION_CHOICES = ( + ('Accessoire', 'Accessoire'), + ('Charges', 'Charges'), + ('Indemnité', 'Indemnité'), + ('RAS', 'RAS'), + ('Traitement', 'Traitement'), +) + +class TypeRemuneration(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + nom = models.CharField(max_length=255) + type_paiement = models.CharField(max_length=30, choices=TYPE_PAIEMENT_CHOICES) + nature_remuneration = models.CharField(max_length=30, choices=NATURE_REMUNERATION_CHOICES) + #Méta + actif = models.BooleanField() + +class TypeRevalorisation(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + nom = models.CharField(max_length=255) + #Méta + actif = models.BooleanField() + +PROPORTION_CHOICES = ( + ('0.5', '0.5'), + ('1', '1'), +) + +class Poste(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + implantation = models.ForeignKey('datamaster_modeles.Implantation', + db_column='implantation', related_name='+') + type_poste = models.ForeignKey('TypePoste', db_column='type_poste') + proportion = models.CharField(max_length=10, choices=PROPORTION_CHOICES) + #(sert à quoi?) renommer "regime_travail" ou autre? convertir data en % (data * 100; ex: 1 = 100%) + #Méta + date_modification = models.DateField(auto_now=True) + actif = models.BooleanField() + + def __unicode__(self): + return u'%s - %s' % (self.implantation, self.type_poste.nom) + + +class Service(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + nom = models.CharField(max_length=255) + #Méta + actif = models.BooleanField() + + def __unicode__(self): + return u'%s' % self.nom + + +TYPE_ORGANISME_CHOICES = ( + ('MAD', 'Mise à disposition'), + ('DET', 'Détachement'), +) + +class OrganismeBstg(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + nom = models.CharField(max_length=255) + type = models.CharField(max_length=10, choices=TYPE_ORGANISME_CHOICES) + #Méta + actif = models.BooleanField() + +CONTRAT_CATEGORIE_CHOICES= ( + ('A', 'A'), + ('C', 'C'), +) +class Statut(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + code = models.CharField(max_length=25, unique=True) + nom = models.CharField(max_length=255) + type_contrat_categorie = models.CharField(max_length=10, choices=CONTRAT_CATEGORIE_CHOICES) + #CHOICES A, C (veut dire quoi?) voir TypeContrat.categorie + #Méta + actif = models.BooleanField() + +TYPE_CLASSEMENT_CHOICES = ( + ('S', 'S'), + ('T', 'T'), +) +class Classement(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + type = models.CharField(max_length=10, choices=TYPE_CLASSEMENT_CHOICES) + echelon = models.IntegerField() + degre = models.IntegerField() + coefficient = models.FloatField() + #Méta + commentaire = models.TextField(null=True, blank=True) + date_modification = models.DateField(auto_now=True) + actif = models.BooleanField() + + def __unicode__(self): + return u'%s.%s.%s (%s)' % (self.type, self.echelon, self.degre, + self.coefficient) + + +class ValeurPoint(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + valeur = models.FloatField() + implantation = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation') + #Méta + annee = models.IntegerField() + + def __unicode__(self): + return u'%s (%s-%s)' % (self.valeur, self.implantation_id, self.annee) + + +class TauxChange(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + devise = models.ForeignKey('Devise', to_field='code', db_column='devise') + annee = models.IntegerField() + taux = models.FloatField() + #Relations + implantation = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation') + + +class Devise(models.Model): + id = models.IntegerField(primary_key=True) + code = models.CharField(max_length=10, unique=True) + nom = models.CharField(max_length=255) + + def __unicode__(self): + return u'%s - %s' % (self.code, self.nom) + + +class TypeContrat(models.Model): + #Identification + id = models.IntegerField(primary_key=True) + nom = models.CharField(max_length=255) + nom_long = models.CharField(max_length=255) #description + categorie = models.CharField(max_length=10, choices=CONTRAT_CATEGORIE_CHOICES) + #Méta + actif = models.BooleanField() -# Create your models here. diff --git a/project/rh/views.py b/project/rh/views.py index 60f00ef..51051bc 100644 --- a/project/rh/views.py +++ b/project/rh/views.py @@ -1 +1,5 @@ -# Create your views here. +# -*- encoding: utf-8 -*- +from django.shortcuts import redirect, render_to_response, get_object_or_404 +from django.template import RequestContext + +from project.rh import models as rh diff --git a/project/rh_v1/tests.py b/project/rh_v1/tests.py deleted file mode 100644 index 2247054..0000000 --- a/project/rh_v1/tests.py +++ /dev/null @@ -1,23 +0,0 @@ -""" -This file demonstrates two different styles of tests (one doctest and one -unittest). These will both pass when you run "manage.py test". - -Replace these with more appropriate tests for your application. -""" - -from django.test import TestCase - -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.failUnlessEqual(1 + 1, 2) - -__test__ = {"doctest": """ -Another way to test that 1 + 1 is equal to 2. - ->>> 1 + 1 == 2 -True -"""} - diff --git a/project/rh_v1/views.py b/project/rh_v1/views.py deleted file mode 100644 index 60f00ef..0000000 --- a/project/rh_v1/views.py +++ /dev/null @@ -1 +0,0 @@ -# Create your views here. -- 1.7.10.4