From 500467432af4f27cc08bec2876fce0cf6574bb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 31 Jan 2021 00:51:09 +0800 Subject: [PATCH] Fixed the cash report to display income first then expense in a transaction, to prevent negative cash balance. --- accounting/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accounting/views.py b/accounting/views.py index 34442bb..a6ee8a1 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -94,7 +94,7 @@ def cash(request: HttpRequest, account: Account, ~Q(account__code__startswith="21"), ~Q(account__code__startswith="22")) .order_by("transaction__date", "transaction__ord", - "is_credit", "ord")) + "-is_credit", "ord")) balance_before = Record.objects \ .filter( Q(transaction__date__lt=period.start), @@ -116,7 +116,7 @@ def cash(request: HttpRequest, account: Account, Q(record__account__code__startswith=account.code))), ~Q(account__code__startswith=account.code)) .order_by("transaction__date", "transaction__ord", - "is_credit", "ord")) + "-is_credit", "ord")) balance_before = Record.objects \ .filter( transaction__date__lt=period.start,