diff options
Diffstat (limited to 'ishtar')
-rw-r--r-- | ishtar/furnitures/models.py | 29 | ||||
-rw-r--r-- | ishtar/templates/sheet_file.html | 99 |
2 files changed, 76 insertions, 52 deletions
diff --git a/ishtar/furnitures/models.py b/ishtar/furnitures/models.py index 03a01e872..3b73baba0 100644 --- a/ishtar/furnitures/models.py +++ b/ishtar/furnitures/models.py @@ -236,6 +236,11 @@ class Person(Address, OwnPerms) : lbl += self.email return lbl + def full_label(self): + return " ".join([getattr(self, attr) + for attr in ('title', 'surname', 'name', 'attached_to') + if getattr(self, attr)]) + class IshtarUser(User): person = models.ForeignKey(Person, verbose_name=_(u"Person"), unique=True) @@ -338,6 +343,26 @@ class File(BaseHistorizedItem, OwnPerms): def get_query_owns(cls, user): return Q(history_modifier=user) & Q(is_active=True) + def closing(self): + if self.is_active: + return + for item in self.history.all(): + if item.is_active(): + break + closing_item = item + return {'date':item.history_date, 'user':item.history_modifier} + + def total_surface_ha(self): + if self.total_surface: + return self.total_surface/10000.0 + + def total_developed_surface_ha(self): + if self.total_developed_surface: + return self.total_developed_surface/10000.0 + + def is_preventive(self): + return FileType.is_preventive(self.file_type.pk) + class OperationType(GeneralType): class Meta: verbose_name = _(u"Operation type") @@ -666,9 +691,9 @@ related_name='+', verbose_name=_(u"Person in charge of the scientific part")) signatory = models.ForeignKey(Person, blank=True, null=True, related_name='+', verbose_name=_(u"Signatory")) operation = models.ForeignKey(Operation, blank=True, null=True, - related_name='+', verbose_name=_(u"Operation")) + related_name='administrative_act', verbose_name=_(u"Operation")) associated_file = models.ForeignKey(File, blank=True, null=True, - related_name='+', verbose_name=_(u"Archaelogical file")) + related_name='administrative_act', verbose_name=_(u"Archaelogical file")) signature_date = models.DateField(_(u"Signature date")) act_object = models.CharField(_(u"Object"), max_length=200) if settings.COUNTRY == 'fr': diff --git a/ishtar/templates/sheet_file.html b/ishtar/templates/sheet_file.html index 67b48d26b..57f1c00fc 100644 --- a/ishtar/templates/sheet_file.html +++ b/ishtar/templates/sheet_file.html @@ -1,79 +1,78 @@ {% extends "sheet.html" %} {% load i18n %} {% block content %} +<h3>{% trans "General"%}</h3> <p><label>{%trans "Year:"%}</label> {{ item.year }}</p> <p><label>{%trans "Numerical reference:"%}</label> {{ item.numeric_reference }}</p> <p><label>{%trans "File's name:"%}</label> {{ item.internal_reference }}</p> <p><label>{%trans "Edition date:"%}</label> {{ item.history.all.0.history_date }}</p> <!-- date = now --> -{% if item.reception_date %}<p>{%trans "Reception date"%} : {{ item.reception_date }}</p>{% endif %} +{% if item.reception_date %}<p><label>{%trans "Reception date:"%}</label> {{ item.reception_date }}</p>{% endif %} +<p><label>{%trans "Creation date:"%}</label> {{ item.creation_date }}</p> {% comment %} -<p>{%trans "Creation date"%} : {% item.creation_date %}</p> <!-- creation date --> {% if item.deadline_date and not item.acts %} <p>{%trans "Deadline"%} : {% item.deadline_date %}</p> <!-- calculated deadline for some preventive files , see saisine_type, not displayed if an act as been send --> {% endif %} +{% endcomment %} -<p>{%trans "Responsible"%} : {% item.responsible %}</p> <!-- file's responsible displayed as Title/Surname/Name/Organisation--> - -{% if item.is_active %}<!-- active or inactive file --> - <p>{%trans "Active file"%}</p> -{% endif %} -{% if item.is_inactive %} - <p>{%trans "Closed file"%}</p> - <p>{%trans "Closure date" %} : {% item.closure_date %} {%trans "by" %} {% item.closer_user%}</p> +<p><label>{%trans "In charge:"%}</label> {{ item.in_charge.full_label }}</p> +<p><label>{%trans "State"%}</label> +{% if item.is_active %}{%trans "Active file"%}</strong></p> +{% else %}{%trans "Closed file"%}</p> +<p><label>{%trans "Closing date:"%}</label> {{ item.closing.date }} <strong>{%trans "by" %}</strong> {{ item.closing.user }}</p> {% endif %} - -<p>{%trans "Type"%} : {% item.type %}</p> <!-- programed or preventive --> -{% if item.related %}<p>{%trans "Related file"%} : {% item.related %}</p>{% endif %} <!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file, mais sais pas faire. Optionnel à ce stade. --> +<p><label>{%trans "Type:"%}</label> {{ item.file_type }}</p> -<!-- Localisation --> -<p>{%trans "Communes"%} : {% item.communes %}</p> <!-- Concat of the communes TITLE 2--> +{% if item.related_file %}<p>{%trans "Related file:"%} {{ item.related_file }}</p>{% endif %} <!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file --> +<p><label>{%trans "Comment:"%}</label> {{ item.comment }}</p> -<p>{%trans "Principal adress"%} : {% item.princ_adress %}</p> <!-- Principal adress of the place --> -<p>{%trans "Complementary adress"%} : {% item.complem_adress %}</p> <!-- Complementary adress of the place --> -<p>{%trans "Postal code"%} : {% item.postal_code %}</p> <!-- Postal code of the place --> +<h3>{% trans "Localisation"%}</h3> +<p><label>{%trans "Towns:"%}</label> {{ item.towns.all|join:", " }}</p> +<p><label>{%trans "Main address:"%}</label> {{ item.address }}</p> +<p><label>{%trans "Complement:"%}</label> {{ item.complem_adress }}</p> +<p><label>{%trans "Postal code:"%}</label> {{ item.postal_code }}</p> -<!-- Surface --> -<p>{%trans "Surface"%} : {% item.surface %} ({% item.surface_ha %) ha)</p> <!-- surface in square meters and hectares--> +<p><label>{%trans "Surface:"%}</label> {{ item.total_surface }} m<sup>2</sup> ({{ item.total_surface_ha }} ha)</p> -<!-- Preventive file --> {% if item.is_preventive %} - <p>{%trans "Planed surface"%} : {% item.planed_surface %} ({% item.planed_surface_ha %) ha)</p> <!-- planed surface in square meters and hectares--> - <p>{%trans "Saisine type"%} : {% item.saisine_type %}</p> <!-- saisine type --> - {% if item.service %}<p>{%trans "Service"%} : {% item.service %}</p>{% endif %} <!-- requesting service --> - {% if item.permit_type %}<p>{%trans "Permit type"%} : {% item.permit_type %}</p>{% endif %} <!-- permit type --> - {% if item.permit_ref %}<p>{%trans "Permit reference"%} : {% item.permit_ref %}</p>{% endif %} <!-- permit reference --> - {% if item.contractor_org %}<p>{%trans "Contractor organisation"%} : {% item.contractor_org %}</p>{% endif %} <!-- Contractor's organisation displayed as concat of Name/Adress/postal_code/city --> - {% if item.contractor %}<p>{%trans "Contractor"%} : {% item.contractor %}</p>{% endif %} <!-- contractor displayed as concat of title/Surname/Name/Adress/postal_code/city --> - <p>{%trans "Numerical reference"%} : {% item.index %}</p> <!-- index --> +<h3>{% trans "Preventive archaelogical file"%}</h3> +<p><label>{%trans "Planed surface:"%}</label> {{ item.total_developed_surface }} m<sup>2</sup> ({{ item.total_developed_surface_ha }} ha)</p> +<p><label>{%trans "Saisine type:"%}</label> {{ item.saisine_type }}</p> +{% if item.town_planning_service %}<p><label>{%trans "Town planning service:"%}</label>{{ item.town_planning_service }}</p>{% endif %} +{% if item.permit_type %}<p><label>{%trans "Permit type:"%}</label> {{ item.permit_type }}</p>{% endif %} +{% if item.permit_reference %}<p><label>{%trans "Permit reference:"%}</label> {{ item.permit_reference }}</p>{% endif %} +{% if item.general_contractor.attached_to %}<p><label>{%trans "General contractor organisation:"%}</label> {{ item.general_contractor.attached_to }}</p>{% endif %} <!-- Contractor's organisation displayed as concat of Name/Adress/postal_code/city --> +{% if item.general_contractor %}<p><label>{%trans "General contractor:"%}</label> {{ item.general_contractor.full_label }}</p>{% endif %} +{% comment %} +<p>{%trans "Numerical reference"%} : {% item.index %}</p> <!-- index --> +{% endcomment %} {% endif %} -<p>{%trans "Comments"%} : {% item.comments %}</p> <!-- free text comments --> - -<!-- associated acts --> - - <table class='adm_acts'> <!-- associated acts class--> - <caption>{%trans "Admninistrative acts"%}</caption> - <tr> - {% for label, in item.data_acts %} - <th>{{label}}</th> - {% endfor %} - </tr> - {% for data, in item.data_acts %} - <tr> - <td>{{year}}</td> - <td>{{reference}}</td> - <td>{{type}}</td> - <td>{{date}}</td> - </tr> - {% endfor %} - </table> - +{% if item.administrative_act.all %} +<table> + <caption>{%trans "Admninistrative acts"%}</caption> + <tr> + <th>{% trans "Year" %}</th> + <th>{% trans "Reference" %}</th> + <th>{% trans "Type" %}</th> + <th>{% trans "Date" %}</th> + </tr> + {% for act in item.administrative_act.all %} + <tr> + <td>{{act.signature_date.year}}</td> + <td>{{act.ref_sra}}</td> + <td>{{act.act_type}}</td> + <td>{{act.signature_date}}</td> + </tr> + {% endfor %} +</table> +{%endif%} +{% comment %} <!-- associated operations --> <table class='adm_ope'> <!-- associated ope class--> |