change alot of things

This commit is contained in:
behruz-dev
2025-11-14 16:28:49 +05:00
parent cbcfa7893a
commit 204c39445e
6 changed files with 530 additions and 184 deletions

View File

@@ -138,15 +138,12 @@ class CounterpartyBalance(BaseModel):
currency='uzs'
).distinct()
total_amount = parties.aggregate(total_price=models.Sum('party_amount__calculated_amount'))['total_price'] or 0
print(total_amount)
income = Income.objects.filter(currency='uzs', counterparty=self.counterparty).aggregate(
total_price=models.Sum("price")
)['total_price'] or 0
print(income)
expence = Expence.objects.filter(currency='uzs', counterparty=self.counterparty).aggregate(
total_price=models.Sum("price")
)['total_price'] or 0
print(expence)
return (total_amount + income) - expence
def __str__(self):