Added to filter the empty accounts in the trial balance, income statement, and balance sheet in the accounting application.
This commit is contained in:
parent
994d3086eb
commit
8c7ffc9b76
@ -529,7 +529,7 @@ def trial_balance(request, period):
|
|||||||
amount=Sum(Case(
|
amount=Sum(Case(
|
||||||
When(record__is_credit=True, then=-1),
|
When(record__is_credit=True, then=-1),
|
||||||
default=1) * F("record__amount")))
|
default=1) * F("record__amount")))
|
||||||
.filter(amount__isnull=False)
|
.filter(Q(amount__isnull=False), ~Q(amount=0))
|
||||||
.annotate(
|
.annotate(
|
||||||
debit_amount=Case(
|
debit_amount=Case(
|
||||||
When(amount__gt=0, then=F("amount")),
|
When(amount__gt=0, then=F("amount")),
|
||||||
@ -550,7 +550,7 @@ def trial_balance(request, period):
|
|||||||
amount=Sum(Case(
|
amount=Sum(Case(
|
||||||
When(record__is_credit=True, then=-1),
|
When(record__is_credit=True, then=-1),
|
||||||
default=1) * F("record__amount")))
|
default=1) * F("record__amount")))
|
||||||
.filter(amount__isnull=False)
|
.filter(Q(amount__isnull=False), ~Q(amount=0))
|
||||||
.annotate(
|
.annotate(
|
||||||
debit_amount=Case(
|
debit_amount=Case(
|
||||||
When(amount__gt=0, then=F("amount")),
|
When(amount__gt=0, then=F("amount")),
|
||||||
@ -632,7 +632,7 @@ def income_statement(request, period):
|
|||||||
amount=Sum(Case(
|
amount=Sum(Case(
|
||||||
When(record__is_credit=True, then=1),
|
When(record__is_credit=True, then=1),
|
||||||
default=-1) * F("record__amount")))
|
default=-1) * F("record__amount")))
|
||||||
.filter(amount__isnull=False)
|
.filter(Q(amount__isnull=False), ~Q(amount=0))
|
||||||
.order_by("code"))
|
.order_by("code"))
|
||||||
groups = list(Account.objects.filter(
|
groups = list(Account.objects.filter(
|
||||||
code__in=[x.code[:2] for x in accounts]))
|
code__in=[x.code[:2] for x in accounts]))
|
||||||
@ -707,7 +707,7 @@ def balance_sheet(request, period):
|
|||||||
amount=Sum(Case(
|
amount=Sum(Case(
|
||||||
When(record__is_credit=True, then=-1),
|
When(record__is_credit=True, then=-1),
|
||||||
default=1) * F("record__amount")))
|
default=1) * F("record__amount")))
|
||||||
.filter(amount__isnull=False)
|
.filter(Q(amount__isnull=False), ~Q(amount=0))
|
||||||
.order_by("code"))
|
.order_by("code"))
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
account.url = reverse("accounting:ledger", args=(account, period))
|
account.url = reverse("accounting:ledger", args=(account, period))
|
||||||
|
Loading…
Reference in New Issue
Block a user