Merge pull request '# Extended OEK report' (#568) from 564_Show_deductions_on_EcoAccount_report into master

Reviewed-on: #568
This commit was merged in pull request #568.
This commit is contained in:
2026-08-03 13:07:34 +02:00
2 changed files with 46 additions and 9 deletions
@@ -30,17 +30,44 @@
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans 'Available' %}</th>
<td>
{{available_total|floatformat:2}} / {{obj.deductable_surface|default_if_none:0.00|floatformat:2}} m²
{% with available as value %}
{% include 'konova/widgets/progressbar.html' %}
{% endwith %}
</td>
</tr>
<tr>
<th scope="row">{% trans 'Deductions for' %}</th>
<td class="align-middle">
<table class="table table-hover">
<th scope="col">
{% translate 'Intervention' %}
</th>
<th scope="col">
{% translate 'Amount' %}
</th>
{% for deduction in deductions %}
<tr>
<td>
<a href="{% url 'intervention:report' deduction.intervention__id %}">
{{deduction.intervention__identifier}} - {{deduction.intervention__title}}
</a>
<br>
</td>
<td>{{ deduction.surface|floatformat:2 }} m²</td>
{% empty %}
{% trans 'None' %}
<td>
{% translate 'None' %}
</td>
<td>
/
</td>
</tr>
{% endfor %}
</table>
</td>
</tr>
<tr>
+11 -1
View File
@@ -66,7 +66,15 @@ class EcoAccountPublicReportView(AbstractPublicReportView):
deductions = acc.deductions.all() \
.distinct("intervention") \
.select_related("intervention") \
.values_list("intervention__id", "intervention__identifier", "intervention__title", named=True)
.values_list("intervention__id",
"intervention__identifier",
"intervention__title",
"surface",
named=True)
# Calculate rest of available surface for deductions
available_total = acc.deductable_rest
available_relative = acc.get_deductable_rest_relative()
context = {
"obj": acc,
@@ -86,6 +94,8 @@ class EcoAccountPublicReportView(AbstractPublicReportView):
"actions": actions,
"deductions": deductions,
"tables_scrollable": False,
"available": available_relative,
"available_total": available_total,
TAB_TITLE_IDENTIFIER: tab_title,
}
context = BaseContext(request, context).context