From e36ae6b8508a1e60f45a2edffb40e4b104e29de9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 13 Dec 2016 11:12:16 +0100 Subject: Treatments: fix associated filename - add modify links in sheets --- archaeological_operations/models.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'archaeological_operations') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 307d02e97..7507da817 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -1037,7 +1037,7 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): def __unicode__(self): return settings.JOINT.join( [unicode(item) for item in [ - self.operation, self.associated_file, self.act_object] + self.related_item, self.act_object] if item]) full_ref_lbl = _(u"Ref.") @@ -1053,6 +1053,10 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): lbl.append(u"[%s]" % self.ref_sra) return u" ".join(lbl) + @property + def associated_filename(self): + return self.get_filename() + @property def towns(self): if self.associated_file: @@ -1081,7 +1085,14 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): @property def related_item(self): - return self.operation if self.operation else self.associated_file + if self.operation: + return self.operation + if self.associated_file: + return self.associated_file + if self.treatment: + return self.treatment + if self.treatment_file: + return self.treatment_file def get_filename(self): filename = self.related_item.associated_filename -- cgit v1.2.3