fix
This commit is contained in:
@@ -102,7 +102,10 @@ class PartyAmount(BaseModel):
|
||||
verbose_name = 'Partiya Summasi'
|
||||
verbose_name_plural = 'Partiya summalari'
|
||||
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if self.calculated_amount < self.paid_amount:
|
||||
self.payment_amount = self.paid_amount - self.calculated_amount
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
class DeletedParty(BaseModel):
|
||||
party = models.ForeignKey(Party, on_delete=models.CASCADE, related_name='deleted_parties')
|
||||
|
||||
@@ -103,6 +103,8 @@ class PartyAmountSerializer(serializers.ModelSerializer):
|
||||
"calculated_amount",
|
||||
"paid_amount",
|
||||
"payment_amount",
|
||||
"debt_amount",
|
||||
"total_expense_amount",
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ class PartyStatisticsApiView(generics.GenericAPIView):
|
||||
overdue_payments=Sum(
|
||||
'party_amount__payment_amount',
|
||||
filter=Q(payment_date__lt=today)
|
||||
)
|
||||
)
|
||||
)
|
||||
res = {
|
||||
'usd': usd,
|
||||
|
||||
Reference in New Issue
Block a user