from datetime import date
from decimal import Decimal
+from django.db.models import signals
from django.core.files.storage import FileSystemStorage
from django.db import models
from django.conf import settings
def __unicode__(self):
representation = u'%s - %s [%s]' % (self.implantation, self.nom,
self.id)
- #if self.is_vacant():
- # representation = representation + u' (VACANT)'
return representation
+
+ prefix_implantation = "implantation__region"
+ def get_regions(self):
+ return [self.implantation.region]
+
+
+class Poste(Poste_):
+ __doc__ = Poste_.__doc__
+
+ # meta dématérialisation : pour permettre le filtrage
+ vacant = models.NullBooleanField(verbose_name = u"Vacant", null=True, blank=True)
+
def is_vacant(self):
vacant = True
if self.occupe_par():
"""Retourne la liste d'employé occupant ce poste.
Généralement, retourne une liste d'un élément.
Si poste inoccupé, retourne liste vide.
+ UTILISE pour mettre a jour le flag vacant
"""
return [d.employe for d in self.rh_dossiers.filter(actif=True, supprime=False) \
.exclude(date_fin__lt=date.today())]
- prefix_implantation = "implantation__region"
- def get_regions(self):
- return [self.implantation.region]
-
-
-class Poste(Poste_):
- __doc__ = Poste_.__doc__
-
POSTE_FINANCEMENT_CHOICES = (
('A', 'A - Frais de personnel'),
ordering = ['implantation__nom']
verbose_name = "Responsable d'implantation"
verbose_name_plural = "Responsables d'implantation"
+