Revised the indents in the views of the accounting application.

This commit is contained in:
依瑪貓 2020-07-21 19:41:53 +08:00
parent 5a48e07ef6
commit e207efc285

View File

@ -96,7 +96,8 @@ def cash(request, account_code, period_spec):
~Q(account__code__startswith="21"),
~Q(account__code__startswith="22"))
.order_by("transaction__date", "is_credit", "ord"))
balance_before = Record.objects.filter(
balance_before = Record.objects\
.filter(
Q(transaction__date__lt=period.start),
(Q(account__code__startswith="11") |
Q(account__code__startswith="12") |
@ -118,7 +119,8 @@ def cash(request, account_code, period_spec):
~Q(account__code__startswith=
current_account.code))
.order_by("transaction__date", "is_credit", "ord"))
balance_before = Record.objects.filter(
balance_before = Record.objects\
.filter(
transaction__date__lt=period.start,
account__code__startswith=current_account.code)\
.aggregate(
@ -203,7 +205,8 @@ def cash_summary(request, account_code):
raise Http404()
# The month summaries
if current_account.code == "0":
months = [RecordSummary(**x) for x in Record.objects.filter(
months = [RecordSummary(**x) for x in Record.objects
.filter(
Q(transaction__in=Transaction.objects.filter(
Q(record__account__code__startswith="11") |
Q(record__account__code__startswith="12") |
@ -227,9 +230,11 @@ def cash_summary(request, account_code):
When(is_credit=False, then=-F("amount")),
default=F("amount"))))]
else:
months = [RecordSummary(**x) for x in Record.objects.filter(
months = [RecordSummary(**x) for x in Record.objects
.filter(
Q(transaction__in=Transaction.objects.filter(
record__account__code__startswith=current_account.code)),
record__account__code__startswith=
current_account.code)),
~Q(account__code__startswith=current_account.code)) \
.annotate(month=TruncMonth("transaction__date")) \
.values("month") \
@ -319,7 +324,8 @@ def ledger(request, account_code, period_spec):
account__code__startswith=current_account.code)
.order_by("transaction__date", "is_credit", "ord"))
if re.match("^[1-3]", current_account.code) is not None:
balance = Record.objects.filter(
balance = Record.objects\
.filter(
transaction__date__lt=period.start,
account__code__startswith=current_account.code)\
.aggregate(
@ -467,7 +473,8 @@ def journal(request, period_spec):
transaction__date__lte=period.end)\
.order_by("transaction__date", "is_credit", "ord")
# The brought-forward records
brought_forward_accounts = Account.objects.filter(
brought_forward_accounts = Account.objects\
.filter(
Q(code__startswith="1")
| Q(code__startswith="2")
| Q(code__startswith="3"))\