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

@ -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