From c7a17cf0f2e6c45e8b6a3851d6994ea330485808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Wed, 22 Jul 2020 08:25:43 +0800 Subject: [PATCH] Added the order of the transaction in a day to the order of the records in the views of the accounting application. --- accounting/views/reports.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/accounting/views/reports.py b/accounting/views/reports.py index 7b5059b..19b5735 100644 --- a/accounting/views/reports.py +++ b/accounting/views/reports.py @@ -94,7 +94,8 @@ def cash(request, account_code, period): ~Q(account__code__startswith="12"), ~Q(account__code__startswith="21"), ~Q(account__code__startswith="22")) - .order_by("transaction__date", "is_credit", "ord")) + .order_by("transaction__date", "transaction__ord", + "is_credit", "ord")) balance_before = Record.objects\ .filter( Q(transaction__date__lt=period.start), @@ -115,7 +116,8 @@ def cash(request, account_code, period): Q(date__lte=period.end), Q(record__account__code__startswith=account_code))), ~Q(account__code__startswith=account_code)) - .order_by("transaction__date", "is_credit", "ord")) + .order_by("transaction__date", "transaction__ord", + "is_credit", "ord")) balance_before = Record.objects\ .filter( transaction__date__lt=period.start, @@ -319,7 +321,7 @@ def ledger(request, account_code, period): transaction__date__gte=period.start, transaction__date__lte=period.end, account__code__startswith=current_account.code) - .order_by("transaction__date", "is_credit", "ord")) + .order_by("transaction__date", "transaction__ord", "is_credit", "ord")) if re.match("^[1-3]", current_account.code) is not None: balance = Record.objects\ .filter( @@ -469,7 +471,7 @@ def journal(request, period): .filter( transaction__date__gte=period.start, transaction__date__lte=period.end)\ - .order_by("transaction__date", "is_credit", "ord") + .order_by("transaction__date", "transaction__ord", "is_credit", "ord") # The brought-forward records brought_forward_accounts = Account.objects\ .filter(