Commit | Line | Data |
---|---|---|
a3121a38 AJ |
1 | # -=- encoding: utf-8 -=- |
2 | ||
3 | from django.db import models | |
4 | from datamaster_modeles.models import Pays, Implantation | |
5 | ||
6 | GENRE_CHOICES = ( | |
7 | ('M', 'Homme'), | |
8 | ('F', 'Femme'), | |
9 | ) | |
10 | SITUATION_CHOICES = ( | |
11 | ('C', 'Célibataire'), | |
12 | ('F', 'Fiancé'), | |
13 | ('M', 'Marié'), | |
14 | ) | |
15 | ||
16 | class Employe(models.Model): | |
17 | #Identification | |
18 | id = models.IntegerField(primary_key=True) | |
19 | nom = models.CharField(max_length=255) | |
20 | prenom = models.CharField(max_length=255) | |
21 | nationalite = models.ForeignKey('datamaster_modeles.Pays', to_field='code', related_name='nationalite', db_column='nationalite') | |
22 | date_naissance = models.DateField(null=True, blank=True) | |
23 | #Infos personnelles | |
24 | genre = models.CharField(max_length=1, choices=GENRE_CHOICES, null=True, blank=True) | |
25 | situation_famille = models.CharField(max_length=1, choices=SITUATION_CHOICES, null=True, blank=True) | |
26 | date_entree = models.DateField(null=True, blank=True) #devrait pas être là | |
27 | #Coordonnées | |
28 | tel_domicile = models.CharField(max_length=255, null=True, blank=True) | |
29 | tel_cellulaire = models.CharField(max_length=255, null=True, blank=True) | |
30 | adresse = models.CharField(max_length=255, null=True, blank=True) | |
31 | no_rue = models.CharField(max_length=255, null=True, blank=True) | |
32 | ville = models.CharField(max_length=255, null=True, blank=True) | |
33 | province = models.CharField(max_length=255, null=True, blank=True) | |
34 | code_postal = models.CharField(max_length=255, null=True, blank=True) | |
35 | pays = models.ForeignKey('datamaster_modeles.Pays', to_field='code', null=True, blank=True, related_name='pays', db_column='pays') | |
36 | #Métas | |
37 | date_creation = models.DateField(auto_now_add=True) | |
38 | date_maj = models.DateField(auto_now=True) | |
39 | commentaire = models.TextField(null=True, blank=True) | |
40 | ||
41 | TYPE_DOSSIER_CHOICES = ( | |
42 | ('2', 'Local'), | |
43 | ('1', 'Expatrié'), | |
44 | ) | |
45 | ||
46 | class Dossier(models.Model): | |
47 | #Identification | |
48 | id = models.IntegerField(primary_key=True) | |
49 | code = models.CharField(max_length=10, unique=True) | |
50 | employe = models.ForeignKey('Employe', db_column='employe') | |
51 | #Postes | |
52 | poste1 = models.ForeignKey('Poste', db_column='poste1', related_name='poste1') | |
53 | implantation1 = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation1', related_name='implantation1') | |
54 | complement1 = models.TextField(null=True, blank=True) | |
55 | responsable_implantation1 = models.IntegerField() | |
56 | poste2 = models.ForeignKey('Poste', db_column='poste2', related_name='poste2', blank=True, null=True) | |
57 | implantation2 = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation2', related_name='implantation2') | |
58 | complement2 = models.TextField(null=True, blank=True) | |
59 | responsable_implantation2 = models.IntegerField() | |
60 | #Relations | |
61 | service = models.ForeignKey('Service', db_column='service') | |
62 | responsable = models.ForeignKey('Employe', db_column='responsable', related_name='responsable') | |
63 | remplacement_de = models.ForeignKey('Employe', db_column='remplacement_de', related_name='remplacement_de') | |
64 | type = models.CharField(max_length=1, choices=TYPE_DOSSIER_CHOICES) | |
65 | statut = models.ForeignKey('Statut', db_column='statut') | |
66 | organisme_bstg = models.ForeignKey('OrganismeBstg', db_column='organisme_bstg') | |
67 | #Rémunération | |
68 | classement = models.ForeignKey('Classement', db_column='classement') | |
69 | regime_travail = models.IntegerField() | |
70 | #Mandat | |
71 | mandat_date_debut = models.DateField() | |
72 | mandat_date_fin = models.DateField() | |
73 | #Contrat | |
74 | contrat_date_debut = models.DateField() | |
75 | contrat_date_fin = models.DateField() | |
76 | type_contrat = models.ForeignKey('TypeContrat', db_column='type_contrat') | |
77 | #Meta | |
78 | date_creation = models.DateField(auto_now_add=True) | |
79 | date_maj = models.DateField(auto_now=True) | |
80 | commentaire = models.TextField(null=True, blank=True) | |
81 | ||
82 | LIEN_PARENTE_CHOICES = ( | |
83 | ('Conjoint', 'Conjoint'), | |
84 | ('Conjointe', 'Conjointe'), | |
85 | ('Fille', 'Fille'), | |
86 | ('Fils', 'Fils'), | |
87 | ) | |
88 | ||
89 | class AyantDroit(models.Model): | |
90 | #Identification | |
91 | id = models.IntegerField(primary_key=True) | |
92 | nom = models.CharField(max_length=255) | |
93 | prenom = models.CharField(max_length=255) | |
94 | #Relation | |
95 | employe = models.ForeignKey('Employe', db_column='employe', related_name='employe') | |
96 | lien_parente = models.CharField(max_length=10, choices=LIEN_PARENTE_CHOICES, null=True, blank=True) | |
97 | #Méta | |
98 | commentaire = models.TextField(null=True, blank=True) | |
99 | actif = models.BooleanField() | |
100 | ||
101 | ||
102 | class Remuneration(models.Model): | |
103 | #Identification | |
104 | id = models.IntegerField(primary_key=True) | |
105 | dossier = models.ForeignKey('Dossier', db_column='dossier') | |
106 | type = models.ForeignKey('TypeRemuneration', db_column='type') | |
107 | type_revalorisation = models.ForeignKey('TypeRevalorisation', db_column='type_revalorisation') | |
108 | montant = models.FloatField() | |
109 | devise = models.ForeignKey('Devise', to_field='code', db_column='devise') | |
110 | date_effective = models.DateField() | |
111 | pourcentage = models.IntegerField() | |
112 | #Méta | |
113 | date_creation = models.DateField(auto_now_add=True) | |
114 | user_creation = models.IntegerField() #User ou employé | |
115 | desactivation = models.BooleanField() # | |
116 | date_desactivation = models.DateField() | |
117 | user_desactivation = models.IntegerField() #User ou employé | |
118 | annule = models.BooleanField() | |
119 | date_annule = models.DateField() | |
120 | user_annule = models.IntegerField() #User ou employé | |
121 | ||
122 | class FamilleEmploi(models.Model): | |
123 | #Identification | |
124 | id = models.IntegerField(primary_key=True) | |
125 | nom = models.CharField(max_length=255) | |
126 | #Méta | |
127 | actif = models.BooleanField() | |
128 | ||
129 | class TypePoste(models.Model): | |
130 | #Identification | |
131 | id = models.IntegerField(primary_key=True) | |
132 | nom = models.CharField(max_length=255) | |
133 | nom_feminin = models.CharField(max_length=255) | |
134 | description = models.CharField(max_length=255) | |
135 | is_responsable = models.BooleanField() | |
136 | famille_emploi = models.ForeignKey('FamilleEmploi', db_column='famille_emploi') | |
137 | #Méta | |
138 | date_modification = models.DateField(auto_now=True) | |
139 | actif = models.BooleanField() | |
140 | ||
141 | TYPE_PAIEMENT_CHOICES = ( | |
142 | ('Régulier', 'Régulier'), | |
143 | ('Ponctuel', 'Ponctuel'), | |
144 | ) | |
145 | ||
146 | NATURE_REMUNERATION_CHOICES = ( | |
147 | ('Accessoire', 'Accessoire'), | |
148 | ('Charges', 'Charges'), | |
149 | ('Indemnité', 'Indemnité'), | |
150 | ('RAS', 'RAS'), | |
151 | ('Traitement', 'Traitement'), | |
152 | ) | |
153 | ||
154 | class TypeRemuneration(models.Model): | |
155 | #Identification | |
156 | id = models.IntegerField(primary_key=True) | |
157 | nom = models.CharField(max_length=255) | |
158 | type_paiement = models.CharField(max_length=30, choices=TYPE_PAIEMENT_CHOICES) | |
159 | nature_remuneration = models.CharField(max_length=30, choices=NATURE_REMUNERATION_CHOICES) | |
160 | #Méta | |
161 | actif = models.BooleanField() | |
162 | ||
163 | class TypeRevalorisation(models.Model): | |
164 | #Identification | |
165 | id = models.IntegerField(primary_key=True) | |
166 | nom = models.CharField(max_length=255) | |
167 | #Méta | |
168 | actif = models.BooleanField() | |
169 | ||
170 | PROPORTION_CHOICES = ( | |
171 | ('0.5', '0.5'), | |
172 | ('1', '1'), | |
173 | ) | |
174 | ||
175 | class Poste(models.Model): | |
176 | #Identification | |
177 | id = models.IntegerField(primary_key=True) | |
178 | implantation = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation') | |
179 | type_poste = models.ForeignKey('TypePoste', db_column='type_poste') | |
180 | proportion = models.CharField(max_length=10, choices=PROPORTION_CHOICES) | |
181 | #(sert à quoi?) renommer "regime_travail" ou autre? convertir data en % (data * 100; ex: 1 = 100%) | |
182 | #Méta | |
183 | date_modification = models.DateField(auto_now=True) | |
184 | actif = models.BooleanField() | |
185 | ||
186 | class Service(models.Model): | |
187 | #Identification | |
188 | id = models.IntegerField(primary_key=True) | |
189 | nom = models.CharField(max_length=255) | |
190 | #Méta | |
191 | actif = models.BooleanField() | |
192 | ||
193 | TYPE_ORGANISME_CHOICES = ( | |
194 | ('MAD', 'Mise à disposition'), | |
195 | ('DET', 'Détachement'), | |
196 | ) | |
197 | ||
198 | class OrganismeBstg(models.Model): | |
199 | #Identification | |
200 | id = models.IntegerField(primary_key=True) | |
201 | nom = models.CharField(max_length=255) | |
202 | type = models.CharField(max_length=10, choices=TYPE_ORGANISME_CHOICES) | |
203 | #Méta | |
204 | actif = models.BooleanField() | |
205 | ||
206 | CONTRAT_CATEGORIE_CHOICES= ( | |
207 | ('A', 'A'), | |
208 | ('C', 'C'), | |
209 | ) | |
210 | class Statut(models.Model): | |
211 | #Identification | |
212 | id = models.IntegerField(primary_key=True) | |
213 | code = models.CharField(max_length=25, unique=True) | |
214 | nom = models.CharField(max_length=255) | |
215 | type_contrat_categorie = models.CharField(max_length=10, choices=CONTRAT_CATEGORIE_CHOICES) | |
216 | #CHOICES A, C (veut dire quoi?) voir TypeContrat.categorie | |
217 | #Méta | |
218 | actif = models.BooleanField() | |
219 | ||
220 | TYPE_CLASSEMENT_CHOICES = ( | |
221 | ('S', 'S'), | |
222 | ('T', 'T'), | |
223 | ) | |
224 | class Classement(models.Model): | |
225 | #Identification | |
226 | id = models.IntegerField(primary_key=True) | |
227 | type = models.CharField(max_length=10, choices=TYPE_CLASSEMENT_CHOICES) | |
228 | echelon = models.IntegerField() | |
229 | degre = models.IntegerField() | |
230 | coefficient = models.FloatField() | |
231 | #Méta | |
232 | commentaire = models.TextField(null=True, blank=True) | |
233 | date_modification = models.DateField(auto_now=True) | |
234 | actif = models.BooleanField() | |
235 | ||
236 | class ValeurPoint(models.Model): | |
237 | #Identification | |
238 | id = models.IntegerField(primary_key=True) | |
239 | valeur = models.FloatField() | |
240 | implantation = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation') | |
241 | #Méta | |
242 | annee = models.IntegerField() | |
243 | ||
244 | class TauxChange(models.Model): | |
245 | #Identification | |
246 | id = models.IntegerField(primary_key=True) | |
247 | devise = models.ForeignKey('Devise', to_field='code', db_column='devise') | |
248 | annee = models.IntegerField() | |
249 | taux = models.FloatField() | |
250 | #Relations | |
251 | implantation = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation') | |
252 | ||
253 | class Devise(models.Model): | |
254 | id = models.IntegerField(primary_key=True) | |
255 | code = models.CharField(max_length=10, unique=True) | |
256 | nom = models.CharField(max_length=255) | |
257 | ||
258 | class TypeContrat(models.Model): | |
259 | #Identification | |
260 | id = models.IntegerField(primary_key=True) | |
261 | nom = models.CharField(max_length=255) | |
262 | nom_long = models.CharField(max_length=255) #description | |
263 | categorie = models.CharField(max_length=10, choices=CONTRAT_CATEGORIE_CHOICES) | |
264 | #Méta | |
265 | actif = models.BooleanField() | |
266 |