diff options
Diffstat (limited to 'archaeological_operations/models.py')
| -rw-r--r-- | archaeological_operations/models.py | 13 | 
1 files changed, 10 insertions, 3 deletions
| diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 9104b0d0d..53e572a20 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -204,7 +204,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,      if settings.COUNTRY == 'fr':          code_patriarche = models.IntegerField(u"Code PATRIARCHE", null=True,                                                blank=True) -        TABLE_COLS = ['code_patriarche'] + TABLE_COLS +        TABLE_COLS = ['full_code_patriarche'] + TABLE_COLS          code_dracar = models.CharField(u"Code DRACAR", max_length=10, null=True,                                         blank=True)          fnap_financing = models.FloatField(u"Financement FNAP (%)", @@ -291,12 +291,13 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,      def get_reference(self, full=False):          ref = ""          if self.code_patriarche: -            ref = unicode(self.code_patriarche) +            ref = "OA" + unicode(self.code_patriarche)              if not full:                  return ref          if self.year and self.operation_code:              if ref:                  ref += u" - " +            ref += settings.OP_PREFIX              ref += u"-".join((unicode(self.year),                                unicode(self.operation_code)))          return ref or "00" @@ -370,9 +371,15 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,              return ""          lbl = unicode(self.operation_code)          year = self.year or 0 -        lbl = u"%d-%s%s" % (year, (3-len(lbl))*"0", lbl) +        lbl = settings.OP_PREFIX + u"%d-%s%s" % (year, (3-len(lbl))*"0", lbl)          return lbl +    @property +    def full_code_patriarche(self): +        if not self.code_patriarche: +            return '' +        return u"OA" + unicode(self.code_patriarche) +      def clean(self):          objs = self.__class__.objects.filter(year=self.year,                                               operation_code=self.operation_code) | 
