fix approval user in execl
This commit is contained in:
parent
dd37ac3720
commit
c76de99e84
1 changed files with 10 additions and 3 deletions
|
|
@ -652,18 +652,25 @@ def export_requests_excel(request):
|
||||||
if last_payment:
|
if last_payment:
|
||||||
settlement_dates_map[invoice.process_instance_id] = last_payment.created
|
settlement_dates_map[invoice.process_instance_id] = last_payment.created
|
||||||
|
|
||||||
# Get installation approval data
|
# Get installation approval data by Water Resource Manager role
|
||||||
from processes.models import StepInstance, StepApproval
|
from processes.models import StepInstance, StepApproval
|
||||||
|
from accounts.models import Role
|
||||||
|
from common.consts import UserRoles
|
||||||
|
|
||||||
|
# Get the Water Resource Manager role
|
||||||
|
water_manager_role = Role.objects.filter(slug=UserRoles.WATER_RESOURCE_MANAGER.value).first()
|
||||||
|
|
||||||
installation_steps = StepInstance.objects.filter(
|
installation_steps = StepInstance.objects.filter(
|
||||||
process_instance_id__in=assignment_ids,
|
process_instance_id__in=assignment_ids,
|
||||||
step__slug='installation_report', # Assuming this is the slug for installation step
|
step__order=6, # Installation report step is order 6
|
||||||
status='completed'
|
status='completed'
|
||||||
).select_related('process_instance')
|
).select_related('process_instance')
|
||||||
|
|
||||||
for step_instance in installation_steps:
|
for step_instance in installation_steps:
|
||||||
# Get the approval that completed this step
|
# Get the approval by Water Resource Manager role that completed this step
|
||||||
approval = StepApproval.objects.filter(
|
approval = StepApproval.objects.filter(
|
||||||
step_instance=step_instance,
|
step_instance=step_instance,
|
||||||
|
role=water_manager_role,
|
||||||
is_deleted=False
|
is_deleted=False
|
||||||
).select_related('approved_by').order_by('-created_at').first()
|
).select_related('approved_by').order_by('-created_at').first()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue