summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index a3af9a0f7..04ad867fc 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -353,6 +353,7 @@ class ActType(GeneralType):
)
intented_to = models.CharField(_(u"Intended to"), max_length=1,
choices=TYPE)
+ code = models.CharField(_(u"Code"), max_length=10, blank=True, null=True)
associated_template = models.ManyToManyField(DocumentTemplate, blank=True,
null=True, verbose_name=_(u"Associated template"))
class Meta:
@@ -411,6 +412,19 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
for item in [self.operation, self.associated_file, self.act_object]
if item])
+ def get_filename(self, operation=False):
+ filename = ''
+ if operation and self.operation:
+ filename = self.operation.associated_filename
+ else:
+ filename = self.associated_file.associated_filename
+ filename = u"-".join(filename.split('-')[:-1]) # remove date
+ if self.act_type.code:
+ filename += u"-" + self.act_type.code
+ if self.signature_date:
+ filename += u"-" + self.signature_date.strftime('%Y%m%d')
+ return filename
+
def publish(self):
if not self.act_type.associated_template.count():
return