From 734f382a6a7873ec2eb00c0da3f0beb80dc615c9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 22 Aug 2016 18:25:53 +0200 Subject: Operations - archaeological files: fix closing info (refs #3175) --- archaeological_files/models.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'archaeological_files') diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 9709824df..1cfbe35d3 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -33,7 +33,8 @@ from ishtar_common.models import GeneralType, BaseHistorizedItem, \ Dashboard, DashboardFormItem, IshtarUser, ValueGetter, ShortMenuItem, \ OperationType, get_external_id -from archaeological_operations.models import get_values_town_related +from archaeological_operations.models import get_values_town_related, \ + ClosedItem class FileType(GeneralType): @@ -68,8 +69,8 @@ if settings.COUNTRY == 'fr': ordering = ('label',) -class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, - DashboardFormItem): +class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter, + ShortMenuItem, DashboardFormItem): TABLE_COLS = ['numeric_reference', 'year', 'internal_reference', 'file_type', 'saisine_type', 'towns', ] year = models.IntegerField(_(u"Year"), @@ -396,18 +397,6 @@ class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, def town_list(self): return u", ".join([unicode(tw) for tw in self.towns.all()]) - def closing(self): - if self.is_active(): - return - q = self.history - if not q.count(): - return {'date': None, 'user': None} - for item in q.all(): - if not item.end_date: - break - return {'date': item.history_date, - 'user': IshtarUser.objects.get(pk=item.history_modifier_id)} - def total_surface_ha(self): if self.total_surface: return self.total_surface / 10000.0 -- cgit v1.2.3