from django.core.files.storage import FileSystemStorage
from django.db import models
import reversion
+from rh import models as rh
from workflow import PosteWorkflow, DossierWorkflow
from workflow import DOSSIER_ETAT_DRH_FINALISATION, DOSSIER_ETAT_REGION_FINALISATION, \
DOSSIER_ETAT_FINALISE
-from managers import DossierManager, PosteManager, PosteComparaisonManager, \
- DossierComparaisonManager
import auf.django.references.models as ref
-from rh import models as rh
+from managers import *
# Constantes
silent_variable_failure = True
-class Poste(PosteWorkflow, models.Model):
+class Poste(PosteWorkflow, rh.Poste_):
type_intervention = models.CharField(max_length=1, choices=POSTE_ACTION, default='N')
id_rh = models.ForeignKey(rh.Poste, null=True, related_name='+',
editable=False,
verbose_name=u"Mise à jour du poste")
- nom = models.CharField(verbose_name=u"Titre du poste", max_length=255)
- implantation = models.ForeignKey(ref.Implantation)
- type_poste = models.ForeignKey(rh.TypePoste, null=True, related_name='+')
- service = models.ForeignKey(rh.Service, related_name='+',
- verbose_name=u"Direction/Service/Pôle support")
- responsable = models.ForeignKey(rh.Poste, related_name='+',
- verbose_name=u"Poste du responsable")
-
- # Contrat
- regime_travail = models.DecimalField(max_digits=12, decimal_places=2,
- default=REGIME_TRAVAIL_DEFAULT,
- verbose_name=u"Temps de travail",
- help_text="% du temps complet")
- regime_travail_nb_heure_semaine = models.DecimalField(max_digits=12,
- decimal_places=2,
- default=REGIME_TRAVAIL_NB_HEURE_SEMAINE_DEFAULT,
- verbose_name=u"Nb. heures par semaine")
-
- # Recrutement
- local = models.BooleanField(verbose_name=u"Local", default=True, blank=True)
- expatrie = models.BooleanField(verbose_name=u"Expatrié", default=False,
- blank=True)
- mise_a_disposition = models.BooleanField(verbose_name=u"Mise à disposition")
- appel = models.CharField(max_length=10, default='interne',
- verbose_name=u"Appel à candidature",
- choices=POSTE_APPEL_CHOICES)
# Rémunération
- classement_min = models.ForeignKey(rh.Classement, related_name='+',
- blank=True, null=True)
- classement_max = models.ForeignKey(rh.Classement, related_name='+',
- blank=True, null=True)
- valeur_point_min = models.ForeignKey(rh.ValeurPoint, related_name='+',
- blank=True, null=True)
- valeur_point_max = models.ForeignKey(rh.ValeurPoint, related_name='+',
- blank=True, null=True)
- devise_min = models.ForeignKey(rh.Devise, default=5, related_name='+')
- devise_max = models.ForeignKey(rh.Devise, default=5, 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_expat_min = models.DecimalField(max_digits=12, decimal_places=2, default=0)
+ indemn_expat_min = models.DecimalField(max_digits=13, decimal_places=2, default=0)
indemn_expat_max = models.DecimalField(max_digits=12, decimal_places=2, default=0)
indemn_fct_min = models.DecimalField(max_digits=12, decimal_places=2, default=0)
indemn_fct_max = models.DecimalField(max_digits=12, decimal_places=2, default=0)
charges_patronales_min = models.DecimalField(max_digits=12, decimal_places=2, default=0)
charges_patronales_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='+',
- default=5)
- 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)
-
- # Justification
- justification = models.TextField()
-
- # Méta
- date_creation = models.DateTimeField(auto_now_add=True)
- date_modification = models.DateTimeField(auto_now=True)
- date_debut = models.DateField(verbose_name=u"Date de début",
- help_text=HELP_TEXT_DATE,
- null=True, blank=True)
- date_fin = models.DateField(null=True, blank=True,
- verbose_name=u"Date de fin",
- help_text=HELP_TEXT_DATE)
- actif = models.BooleanField(default=True)
# Managers
objects = PosteManager()
objects = PosteComparaisonManager()
def taux_devise(self):
+ if not self.devise:
+ return None
if self.devise.code == 'EUR':
return 1
liste_taux = self.devise.tauxchange_set.order_by('-annee')