update for wage

This commit is contained in:
2026-01-24 22:02:04 +03:30
parent 1beec1d1ef
commit 0e27b44499

View File

@@ -3175,10 +3175,16 @@ class KillRequestViewSet(viewsets.ModelViewSet):
except: except:
recive_date = datetime.strptime(str(request.data['recive_date']), '%Y-%m-%d %H:%M:%S').date() recive_date = datetime.strptime(str(request.data['recive_date']), '%Y-%m-%d %H:%M:%S').date()
total_unpaid_wage = get_finance_info(kill_house)['total_price'] total_unpaid_wage = get_finance_info(kill_house)['total_price']
slaughter_transactions = InternalTransaction.objects.filter( if kill_house.killer and kill_house.type == 'public':
Q(kill_house=kill_house) | Q(parent_kill_house=kill_house), slaughter_transactions = InternalTransaction.objects.filter(
status='completed', kill_house=kill_house,parent_kill_house=kill_house,
trash=False) status='completed',
trash=False)
else:
slaughter_transactions = InternalTransaction.objects.filter(
Q(kill_house=kill_house) | Q(parent_kill_house=kill_house),
status='completed',
trash=False)
total_paid_wage += slaughter_transactions.aggregate(total=Sum('amount'))[ total_paid_wage += slaughter_transactions.aggregate(total=Sum('amount'))[
'total'] or 0 'total'] or 0
@@ -17528,9 +17534,15 @@ class MarketKillRequestViewSet(viewsets.ModelViewSet):
kill_house_purchase = KillHousePurchaseRequest.objects.filter(kill_house=kill_house).first() kill_house_purchase = KillHousePurchaseRequest.objects.filter(kill_house=kill_house).first()
total_unpaid_wage = get_finance_info(kill_house)['total_price'] total_unpaid_wage = get_finance_info(kill_house)['total_price']
slaughter_transactions = InternalTransaction.objects.filter( if kill_house.killer and kill_house.type == 'public':
kill_house=kill_house, status='completed',
trash=False) slaughter_transactions = InternalTransaction.objects.filter(
kill_house=kill_house,parent_kill_house=kill_house, status='completed',
trash=False)
else:
slaughter_transactions = InternalTransaction.objects.filter(
kill_house=kill_house, status='completed',
trash=False)
total_paid_wage += slaughter_transactions.aggregate(total=Sum('amount'))[ total_paid_wage += slaughter_transactions.aggregate(total=Sum('amount'))[
'total'] or 0 'total'] or 0