From 465cd1aad9b091d18f4c9a208d0c091bf14f6dc0 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 23 May 2019 16:01:37 +0200 Subject: Find sheet: display associated treatment files --- archaeological_finds/models_finds.py | 10 ++++++ .../templates/ishtar/sheet_find.html | 39 ++++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index e62c41887..5bffe9851 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1741,6 +1741,16 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, QRCodeItem, def limited_non_modif_treatments(self): return self.non_modif_treatments(15) + def associated_treatment_files(self): + from archaeological_finds.models_treatments import \ + TreatmentFile + return TreatmentFile.objects.filter( + associated_basket__items__pk=self.pk).order_by( + 'reception_date', 'creation_date', 'end_date') + + def associated_treatment_files_count(self): + return self.associated_treatment_files().count() + @property def weight_string(self): if not self.weight: diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index 7644acb60..268a31d39 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -21,9 +21,10 @@ {% with m2m_listing_datings=item|m2m_listing:'datings' %} {% with non_modif_treatments_count=item.non_modif_treatments_count %} +{% with associated_treatment_files_count=item.associated_treatment_files_count %} {% with display_datings=item.integrities.count|or_:item.remarkabilities.count|or_:item.conservatory_state|or_:item.conservatory_comment|or_:item.alterations.count|or_:item.alteration_causes.count|or_:item.preservation_to_considers.count|or_:item.appraisal_date|or_:item.treatment_emergency|or_:item.insurance_value|or_:item.estimated_value|or_:m2m_listing_datings|or_:item.dating_comment %} -{% with display_warehouse_treatments=item.container|or_:item.container_ref|or_:item.upstream_treatment|or_:item.downstream_treatment|or_:non_modif_treatments_count %} +{% with display_warehouse_treatments=item.container|or_:item.container_ref|or_:item.upstream_treatment|or_:item.downstream_treatment|or_:non_modif_treatments_count|or_:associated_treatment_files_count %} {% with can_view_documents=permission_view_own_document|or_:permission_view_document %} {% with display_documents=can_view_documents|and_:item.documents.count %} @@ -381,6 +382,40 @@

{% trans "CSV" %} ({{ENCODING}})

{% endif %} {% endif %} + {% if item.associated_treatment_files_count %} +

{% trans "Treatment requests" %}

+ + + + + + + + + + + + + {% for treatment_file in item.associated_treatment_files %} + + + + + + + + + + + + {% endfor %} +
 {% trans "Year - index" %}{% trans "Type" %}{% trans "Name" %}{% trans "Person in charge" %}{% trans "Applicant" %}{% trans "Applicant organisation" %}{% trans "Reception date" %}{% trans "End date" %}
+ + + + {{ treatment_file.year }} - {{treatment_file.index}}{{ treatment_file.type }}{{ treatment_file.name|default_if_none:"-" }}{{ treatment_file.in_charge|default_if_none:"" }}{{ treatment_file.applicant|default_if_none:"" }}{{ treatment_file.applicant_organisation|default_if_none:"" }}{{ treatment_file.reception_date|default_if_none:"" }}{{ treatment_file.end_date|default_if_none:"" }}
+ {% endif %} {% endif %} {% if display_documents %} @@ -398,7 +433,7 @@ {% endif %} -{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %} +{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %} {% endblock %} -- cgit v1.2.3