fix force approve and vat show

This commit is contained in:
aminhashemi92 2025-10-07 07:45:09 +03:30
parent 65cc48769d
commit 169a9bd624
10 changed files with 133 additions and 5 deletions

View file

@ -245,7 +245,12 @@
<small class="text-muted">{{ item.progress_percentage }}%</small>
</div>
</td>
<td>{{ item.instance.get_status_display_with_color|safe }}</td>
<td>
{{ item.instance.get_status_display_with_color|safe }}
{% if item.emergency_approved %}
<span class="badge bg-warning text-dark ms-1" title="تایید اضطراری">تایید اضطراری</span>
{% endif %}
</td>
<td>
{% if item.installation_scheduled_date %}
<div>

View file

@ -123,6 +123,17 @@ def request_list(request):
reference_date = None
installation_scheduled_date = reference_date if reference_date and reference_date > sched_date else sched_date
# Emergency approved flag (final settlement step forced approval)
try:
final_settlement_step = instance.process.steps.filter(order=8).first()
emergency_approved = False
if final_settlement_step:
si = instance.step_instances.filter(step=final_settlement_step).first()
emergency_approved = bool(si and si.status == 'approved')
except Exception:
emergency_approved = False
instances_with_progress.append({
'instance': instance,
'progress_percentage': round(progress_percentage),
@ -130,6 +141,7 @@ def request_list(request):
'total_steps': total_steps,
'installation_scheduled_date': installation_scheduled_date,
'installation_overdue_days': overdue_days,
'emergency_approved': emergency_approved,
})
# Summary stats for header cards