From bd9e6483dd3d7416e1b228e82a70b5d6ba6d3ce6 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 9 Mar 2011 22:56:48 +0100 Subject: Operation sheet (refs #16) --- ishtar/furnitures/forms.py | 4 - ishtar/furnitures/models.py | 13 ++- ishtar/furnitures/urls.py | 3 + ishtar/furnitures/views.py | 2 + ishtar/templates/default_wizard.html | 1 + ishtar/templates/sheet_ope.html | 125 -------------------------- ishtar/templates/sheet_operation.html | 128 +++++++++++++++++++++++++++ ishtar/templates/sheet_operation_pdf.html | 14 +++ ishtar/templates/sheet_operation_window.html | 3 + static/media/style.css | 7 ++ 10 files changed, 170 insertions(+), 130 deletions(-) delete mode 100644 ishtar/templates/sheet_ope.html create mode 100644 ishtar/templates/sheet_operation.html create mode 100644 ishtar/templates/sheet_operation_pdf.html create mode 100644 ishtar/templates/sheet_operation_window.html diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py index 642da9b4b..821ef1bb9 100644 --- a/ishtar/furnitures/forms.py +++ b/ishtar/furnitures/forms.py @@ -1631,10 +1631,7 @@ class RecordWizard(Wizard): r = super(RecordWizard, self).done(request, storage, form_list, return_object=True, **kwargs) if type(r) not in (list, tuple) or len(r) != 2: - print 1 - print r return r - print 2 obj, res = r for form in form_list: if not hasattr(form, 'prefix') \ @@ -1646,7 +1643,6 @@ class RecordWizard(Wizard): if not frm.is_valid(): continue dct = frm.cleaned_data.copy() - print dct if not dct: continue try: diff --git a/ishtar/furnitures/models.py b/ishtar/furnitures/models.py index c1980f68c..b9dc19afe 100644 --- a/ishtar/furnitures/models.py +++ b/ishtar/furnitures/models.py @@ -449,6 +449,16 @@ class Operation(BaseHistorizedItem, OwnPerms): return Q(in_charge=user.person)|Q(history_modifier=user)\ & Q(end_date__isnull=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} +""" class Parcel(LightHistorizedItem): associated_file = models.ForeignKey(File, related_name='parcels', blank=True, null=True, verbose_name=_(u"File")) @@ -549,7 +559,8 @@ class Unit(GeneralType) : return self.label class ContextRecord(BaseHistorizedItem, OwnPerms): - parcel = models.ForeignKey(Parcel, verbose_name=_(u"Parcel")) + parcel = models.ForeignKey(Parcel, verbose_name=_(u"Parcel"), + related_name='context_records') label = models.CharField(_(u"Label"), max_length=200) description = models.TextField(_("Description"), blank=True, null=True) lenght = models.IntegerField(_(u"Lenght")) diff --git a/ishtar/furnitures/urls.py b/ishtar/furnitures/urls.py index 0e28043e2..71a3a116c 100644 --- a/ishtar/furnitures/urls.py +++ b/ishtar/furnitures/urls.py @@ -98,6 +98,9 @@ urlpatterns += patterns('ishtar.furnitures.views', url(BASE_URL + r'show-operation/(?P.+)?/(?P.+)?$', 'show_operation', name='show-operation'), + url(BASE_URL + r'show-contextrecord/(?P.+)?/(?P.+)?$', + 'show_contextrecord', + name='show-contextrecord'), url(BASE_URL + r'update-current-item/$', 'update_current_item', name='update-current-item'), url(BASE_URL + r'get-administrativeact/(?P.+)?$', diff --git a/ishtar/furnitures/views.py b/ishtar/furnitures/views.py index 1be067454..b212dee77 100644 --- a/ishtar/furnitures/views.py +++ b/ishtar/furnitures/views.py @@ -374,6 +374,8 @@ def autocomplete_organization(request, orga_type=None): for org in organizations]) return HttpResponse(data, mimetype='text/plain') +show_contextrecord = show_item(models.ContextRecord, 'contextrecord') + def action(request, action_slug, obj_id=None, *args, **kwargs): """ Action management diff --git a/ishtar/templates/default_wizard.html b/ishtar/templates/default_wizard.html index 1666b4979..70563786b 100644 --- a/ishtar/templates/default_wizard.html +++ b/ishtar/templates/default_wizard.html @@ -14,6 +14,7 @@
{% if form.forms %} +
{%if form.non_form_errors%}{%endif%} {{ form.management_form }} diff --git a/ishtar/templates/sheet_ope.html b/ishtar/templates/sheet_ope.html deleted file mode 100644 index 37ddece93..000000000 --- a/ishtar/templates/sheet_ope.html +++ /dev/null @@ -1,125 +0,0 @@ -{% extends "sheet.html" %} -{% load i18n %} -{% block content %} - -

{% trans "General"%}

-

{{ item.year }}

-

{{ item.numeric_reference }}

- -{% if item.patriarche_code %}

{{ item.patriarche_code }}

{%endif%} -{% if item.patriarche_code_not_recorded %}

{%endif%} - -

{{ item.internal_reference }}

- -

{{ item.history.all.0.history_date }}

- -

{{ item.begin_date }}

-

{{ item.end_date }}

- -

{{ item.head_scientist.full_label }}

-

{% if item.is_active %}{%trans "Active file"%}

-{% else %}{%trans "Closed operation"%}

-

{{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}

-{% endif %} -

{{ item.operation_type }}

-

{{ item.total_surface }} m2 ({{ item.total_surface_ha }} ha)

-

{{ item.cost }} Euros, ({{ item.cost_by_m2 }} Euros/m2)

-

{{ item.duration }} {%trans "Day"%}s

- -

{{ item.remains.all|join:", " }}

-

{{ item.periods.all|join:", " }}

- -{% if item.related_file %} -

{{ item.related_file }}

-{% if item.related_file.is_preventive %} -{% if item.operator_reference_code %}

{{ item.operator_reference_code }}

{% endif %} -{% if item.related_file.town_planning_service %}

{{ item.related_file.town_planning_service }}

{% endif %} -{% if item.related_file.permit_type %}

{{ item.related_file.permit_type }}

{% endif %} -{% if item.related_file.permit_reference %}

{{ item.related_file.permit_reference }}

{% endif %} -{% if item.related_file.general_contractor.attached_to %}

{{ item.related_file.general_contractor.attached_to }}

{% endif %} -{% if item.related_file.general_contractor %}

{{ item.related_file.general_contractor.full_label }}

{% endif %} -{% endif %} -{% endif %} - -{% if item.comment %}

{{ item.comment }}

{%endif%} - -

{% trans "Localisation"%}

-

{{ item.towns.all|join:", " }}

- -

{{ item.address }}

-{% if item.address_complement %}

{{ item.address_complement }}

{%endif%} -{% if item.postal_code %}

{{ item.postal_code }}

{%endif%} - -

{{ item.lambert_x }}

-

{{ item.lambert_y }}

-

{{ item.altitude }}

- -
{{form.non_form_errors}}
- - - - - - - - - {% for parcels in item.parcel.all %} - - - - - - - - {% empty %} - - {% endfor %} -
{%trans "Associated parcels"%}
{% trans "Commune" %}{% trans "Year" %}{% trans "Section" %}{% trans "Parcel" %}{% trans "Owner" %}
{{operation.commune}}{{operation.year}}{{operation.section}}{{operation.parcel}}{{operation.parcel.owner}}
{% trans "No parcel associated to this operation" %}
- -

{% trans "Admninistrative acts"%}

- - - - - - - - - {% for act in item.administrative_act.all %} - - - - - - - {% empty %} - - {% endfor %} -
{%trans "Admninistrative acts"%}
{% trans "Year" %}{% trans "Reference" %}{% trans "Type" %}{% trans "Date" %}
{{act.signature_date.year}}{{act.ref_sra}}{{act.act_type}}{{act.signature_date}}
{% trans "No administrative act associated to this operation" %}
- -

{% trans "Recording Units"%}

- - - - - - - - - - - {% for record_unit in item.record_unit.all %} - - - - - - - - - {% empty %} - - {% endfor %} -
{%trans "Recording Units"%}
{% trans "Label" %}{% trans "Type" %}{% trans "Chronology" %}{% trans "Description" %}{% trans "Parcel" %} 
{{ record_unit.label }}{{record_unit.unit_type}}{{ record_unit.period.all|join:", " }}{{ record_unit.description }}{{ record_unit.section_and_parcel }}
{% trans "No recording unit associated to this operation" %}
- -{% endblock %} diff --git a/ishtar/templates/sheet_operation.html b/ishtar/templates/sheet_operation.html new file mode 100644 index 000000000..8902126c6 --- /dev/null +++ b/ishtar/templates/sheet_operation.html @@ -0,0 +1,128 @@ +{% extends "sheet.html" %} +{% load i18n %} +{% block content %} + +

{% trans "General"%}

+

{{ item.year }}

+

{{ item.operation_code }}

+ +{% if item.code_patriarche %}

{{ item.code_patriarche }}

{%else%} +

{%trans "Patriarche OA code not yet recorded!"%}

{%endif%} + +{#

{{ item.internal_reference }}

#} + +

{{ item.history.all.0.history_date }}

+ +

{{ item.start_date }}

+

{{ item.end_date }}

+ +

{{ item.in_charge.full_label }}

+

{% if item.is_active %}{%trans "Active file"%}

+{% else %}{%trans "Closed operation"%}

+

{{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}

+{% endif %} +

{{ item.operation_type }}

+{#

{{ item.total_surface }} m2 ({{ item.total_surface_ha }} ha)

#} +{% if item.cost %}

{{ item.cost }} Euros, ({{ item.cost_by_m2 }} Euros/m2)

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

{{ item.duration }} {%trans "Day"%}s

{%endif%} + +

{{ item.remains.all|join:", " }}

+

{{ item.periods.all|join:", " }}

+ +{% if item.associated_file %} +

{{ item.associated_file }}

+{% if item.associated_file.is_preventive %} +{#{% if item.operator_reference_code %}

{{ item.operator_reference_code }}

{% endif %}#} +{% if item.associated_file.town_planning_service %}

{{ item.associated_file.town_planning_service }}

{% endif %} +{% if item.associated_file.permit_type %}

{{ item.associated_file.permit_type }}

{% endif %} +{% if item.associated_file.permit_reference %}

{{ item.associated_file.permit_reference }}

{% endif %} +{% if item.associated_file.general_contractor.attached_to %}

{{ item.associated_file.general_contractor.attached_to }}

{% endif %} +{% if item.associated_file.general_contractor %}

{{ item.associated_file.general_contractor.full_label }}

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

{{ item.comment }}

{%endif%} + +

{% trans "Localisation"%}

+

{{ item.towns.all|join:", " }}

+ +

{{ item.associated_file.address }}

+{% if item.associated_file.address_complement %}

{{ item.associated_file.address_complement }}

{%endif%} +{% if item.associated_file.postal_code %}

{{ item.associated_file.postal_code }}

{%endif%} + +{% comment %} +

{{ item.lambert_x }}

+

{{ item.lambert_y }}

+

{{ item.altitude }}

+{% endcomment %} + + + + + + + + {##} + + {% for parcel in item.parcels.all %} + + + + + + {##} + + {% empty %} + + {% endfor %} +
{%trans "Associated parcels"%}
{% trans "Commune" %}{% trans "Year" %}{% trans "Section" %}{% trans "Parcel" %}{% trans "Owner" %}
{{parcel.town}}{{parcel.year}}{{parcel.section}}{{parcel.parcel_number}}{{operation.parcel.owner}}
{% trans "No parcel associated to this operation" %}
+ + + + + + + + + + {% for act in item.administrative_act.all %} + + + + + + + {% empty %} + + {% endfor %} +
{%trans "Admninistrative acts"%}
{% trans "Year" %}{% trans "Reference" %}{% trans "Type" %}{% trans "Date" %}
{{act.signature_date.year}}{{act.ref_sra}}{{act.act_type}}{{act.signature_date}}
{% trans "No administrative act associated to this operation" %}
+ + + + + + + + + + + + {% for parcel in item.parcels.all %} + {% for context_record in item.context_record.all %} + + + + {# periods ?#} + + + + + {% empty %} + + {% endfor %} + {% empty %} + + {% endfor %} +
{%trans "Context records"%}
{% trans "Label" %}{% trans "Type" %}{% trans "Chronology" %}{% trans "Description" %}{% trans "Parcel" %} 
{{ context_record.label }}{{context_record.unit}}{{ context_record.datings.all|join:", " }}{{ context_record.description }}{{ parcel.section }} - {{parcel.parcel_number}}
{% trans "No context record associated to parcel " %}{{ parcel.section }} - {{parcel.parcel_number}}
{% trans "No context record associated to this operation" %}
+ +{% endblock %} diff --git a/ishtar/templates/sheet_operation_pdf.html b/ishtar/templates/sheet_operation_pdf.html new file mode 100644 index 000000000..30f9595bf --- /dev/null +++ b/ishtar/templates/sheet_operation_pdf.html @@ -0,0 +1,14 @@ +{% extends "sheet_operation.html" %} +{% block main_head %} +{{ block.super }} +
+Ishtar – {{APP_NAME}} – {{item}} +
+{% endblock %} +{%block main_foot%} +
+– – +
+ + +{%endblock%} diff --git a/ishtar/templates/sheet_operation_window.html b/ishtar/templates/sheet_operation_window.html new file mode 100644 index 000000000..9c595a1e9 --- /dev/null +++ b/ishtar/templates/sheet_operation_window.html @@ -0,0 +1,3 @@ +{% extends "sheet_operation.html" %} +{% block main_head %}{%endblock%} +{% block main_foot %}{%endblock%} diff --git a/static/media/style.css b/static/media/style.css index 5d00ff793..8aa4ead48 100644 --- a/static/media/style.css +++ b/static/media/style.css @@ -343,3 +343,10 @@ table.confirm tr.spacer td:last-child{ margin:0.3em; } +#window p.alert{ + color:#D14; + display:block; + margin-left:1em; + font-style:italic; +} + -- cgit v1.2.3