Added the account order to the account options in the transaction form in the accounting application.

This commit is contained in:
依瑪貓 2020-08-11 11:06:42 +08:00
parent 189751a353
commit 994d3086eb

View File

@ -1144,7 +1144,8 @@ def api_account_options(request):
.annotate(is_in_use=Case( .annotate(is_in_use=Case(
When(record_count__gt=0, then=True), When(record_count__gt=0, then=True),
default=False, default=False,
output_field=BooleanField())) output_field=BooleanField()))\
.order_by("code")
for x in accounts: for x in accounts:
x.is_for_debit = re.match("^([1235689]|7[5678])", x.code) is not None x.is_for_debit = re.match("^([1235689]|7[5678])", x.code) is not None
x.is_for_credit = re.match("^([123489]|7[1234])", x.code) is not None x.is_for_credit = re.match("^([123489]|7[1234])", x.code) is not None