2020-06-30 20:59:24 +08:00
|
|
|
# The accounting application of the Mia project.
|
|
|
|
# by imacat <imacat@mail.imacat.idv.tw>, 2020/6/30
|
|
|
|
|
|
|
|
# Copyright (c) 2020 imacat.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
"""The route settings of the accounting application.
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2020-06-30 23:49:21 +08:00
|
|
|
from django.urls import path, register_converter
|
2020-07-30 00:10:11 +08:00
|
|
|
from django.views.decorators.http import require_GET
|
|
|
|
from django.views.generic import RedirectView
|
2020-06-30 20:59:24 +08:00
|
|
|
|
2020-07-30 00:12:13 +08:00
|
|
|
from mia_core.digest_auth import login_required
|
2020-07-23 14:17:05 +08:00
|
|
|
from . import converters, views
|
2020-06-30 20:59:24 +08:00
|
|
|
|
2020-07-23 01:22:11 +08:00
|
|
|
register_converter(converters.PeriodConverter, "period")
|
2020-08-07 10:10:33 +08:00
|
|
|
register_converter(converters.AccountConverter, "account")
|
2020-07-23 08:33:53 +08:00
|
|
|
register_converter(converters.CashAccountConverter, "cash-account")
|
|
|
|
register_converter(converters.LedgerAccountConverter, "ledger-account")
|
2020-07-23 22:02:26 +08:00
|
|
|
register_converter(converters.TransactionTypeConverter, "txn-type")
|
|
|
|
register_converter(converters.TransactionConverter, "txn")
|
2020-07-23 23:01:19 +08:00
|
|
|
register_converter(converters.DateConverter, "date")
|
2020-07-21 22:05:39 +08:00
|
|
|
|
2020-06-30 20:59:24 +08:00
|
|
|
app_name = "accounting"
|
|
|
|
urlpatterns = [
|
2020-07-30 00:12:13 +08:00
|
|
|
path("", require_GET(login_required(RedirectView.as_view(
|
2020-08-02 00:08:53 +08:00
|
|
|
query_string=True,
|
|
|
|
pattern_name="accounting:cash.home",
|
2020-07-30 00:10:11 +08:00
|
|
|
))), name="home"),
|
|
|
|
path("cash",
|
|
|
|
views.CashDefaultView.as_view(), name="cash.home"),
|
2020-07-23 08:33:53 +08:00
|
|
|
path("cash/<cash-account:account>/<period:period>",
|
2020-07-23 14:17:05 +08:00
|
|
|
views.cash, name="cash"),
|
2020-07-11 07:12:53 +08:00
|
|
|
path("cash-summary",
|
2020-07-30 00:10:11 +08:00
|
|
|
views.CashSummaryDefaultView.as_view(), name="cash-summary.home"),
|
2020-07-23 08:33:53 +08:00
|
|
|
path("cash-summary/<cash-account:account>",
|
2020-07-23 14:17:05 +08:00
|
|
|
views.cash_summary, name="cash-summary"),
|
2020-07-11 07:12:53 +08:00
|
|
|
path("ledger",
|
2020-07-30 00:10:11 +08:00
|
|
|
views.LedgerDefaultView.as_view(), name="ledger.home"),
|
2020-07-23 08:33:53 +08:00
|
|
|
path("ledger/<ledger-account:account>/<period:period>",
|
2020-07-23 14:17:05 +08:00
|
|
|
views.ledger, name="ledger"),
|
2020-07-11 07:12:53 +08:00
|
|
|
path("ledger-summary",
|
2020-07-30 00:10:11 +08:00
|
|
|
views.LedgerSummaryDefaultView.as_view(), name="ledger-summary.home"),
|
2020-07-23 08:33:53 +08:00
|
|
|
path("ledger-summary/<ledger-account:account>",
|
2020-07-23 14:17:05 +08:00
|
|
|
views.ledger_summary, name="ledger-summary"),
|
2020-07-11 07:12:53 +08:00
|
|
|
path("journal",
|
2020-07-30 00:10:11 +08:00
|
|
|
views.JournalDefaultView.as_view(), name="journal.home"),
|
2020-07-21 22:05:39 +08:00
|
|
|
path("journal/<period:period>",
|
2020-07-23 14:17:05 +08:00
|
|
|
views.journal, name="journal"),
|
2020-07-11 07:12:53 +08:00
|
|
|
path("trial-balance",
|
2020-07-30 00:10:11 +08:00
|
|
|
views.TrialBalanceDefaultView.as_view(), name="trial-balance.home"),
|
2020-07-21 22:05:39 +08:00
|
|
|
path("trial-balance/<period:period>",
|
2020-07-23 14:17:05 +08:00
|
|
|
views.trial_balance, name="trial-balance"),
|
2020-07-11 07:12:53 +08:00
|
|
|
path("income-statement",
|
2020-07-30 00:10:11 +08:00
|
|
|
views.IncomeStatementDefaultView.as_view(),
|
|
|
|
name="income-statement.home"),
|
2020-07-21 22:05:39 +08:00
|
|
|
path("income-statement/<period:period>",
|
2020-07-23 14:17:05 +08:00
|
|
|
views.income_statement, name="income-statement"),
|
2020-07-11 07:12:53 +08:00
|
|
|
path("balance-sheet",
|
2020-07-30 00:10:11 +08:00
|
|
|
views.BalanceSheetDefaultView.as_view(), name="balance-sheet.home"),
|
2020-07-21 22:05:39 +08:00
|
|
|
path("balance-sheet/<period:period>",
|
2020-07-23 14:17:05 +08:00
|
|
|
views.balance_sheet, name="balance-sheet"),
|
2020-07-09 23:19:48 +08:00
|
|
|
path("search",
|
2020-07-23 14:17:05 +08:00
|
|
|
views.search, name="search"),
|
2020-07-29 15:06:23 +08:00
|
|
|
path("transactions/<txn-type:txn_type>/create",
|
2020-08-09 12:19:11 +08:00
|
|
|
views.txn_form, name="transactions.create"),
|
2020-07-29 15:06:23 +08:00
|
|
|
path("transactions/<txn-type:txn_type>/store",
|
2020-08-02 03:08:26 +08:00
|
|
|
views.txn_store, name="transactions.store"),
|
2020-08-02 03:00:23 +08:00
|
|
|
path("transactions/<txn-type:txn_type>/<txn:txn>",
|
2020-08-08 16:08:15 +08:00
|
|
|
views.TransactionView.as_view(), name="transactions.detail"),
|
2020-08-02 03:00:23 +08:00
|
|
|
path("transactions/<txn-type:txn_type>/<txn:txn>/edit",
|
2020-08-09 12:19:11 +08:00
|
|
|
views.txn_form, name="transactions.edit"),
|
2020-08-02 03:00:23 +08:00
|
|
|
path("transactions/<txn-type:txn_type>/<txn:txn>/update",
|
2020-08-02 03:08:26 +08:00
|
|
|
views.txn_store, name="transactions.update"),
|
2020-08-02 03:00:23 +08:00
|
|
|
path("transactions/<txn:txn>/delete",
|
2020-08-09 13:19:20 +08:00
|
|
|
views.TransactionDeleteView.as_view(), name="transactions.delete"),
|
2020-07-23 23:01:19 +08:00
|
|
|
path("transactions/sort/<date:date>",
|
2020-08-06 23:51:20 +08:00
|
|
|
views.txn_sort, name="transactions.sort"),
|
2020-07-21 10:38:47 +08:00
|
|
|
path("accounts",
|
2020-08-07 10:10:33 +08:00
|
|
|
views.AccountListView.as_view(), name="accounts"),
|
2020-07-21 10:38:47 +08:00
|
|
|
path("accounts/create",
|
2020-08-14 00:36:29 +08:00
|
|
|
views.AccountFormView.as_view(), name="accounts.create"),
|
2020-07-21 10:38:47 +08:00
|
|
|
path("accounts/store",
|
2020-08-14 00:36:29 +08:00
|
|
|
views.AccountFormView.as_view(), name="accounts.store"),
|
2020-08-07 10:10:33 +08:00
|
|
|
path("accounts/<account:account>",
|
2020-08-08 17:05:24 +08:00
|
|
|
views.AccountView.as_view(), name="accounts.detail"),
|
2020-08-07 10:10:33 +08:00
|
|
|
path("accounts/<account:account>/edit",
|
2020-08-14 00:36:29 +08:00
|
|
|
views.AccountFormView.as_view(), name="accounts.edit"),
|
2020-08-07 10:10:33 +08:00
|
|
|
path("accounts/<account:account>/update",
|
2020-08-14 00:36:29 +08:00
|
|
|
views.AccountFormView.as_view(), name="accounts.update"),
|
2020-08-07 10:10:33 +08:00
|
|
|
path("accounts/<account:account>/delete",
|
2020-08-09 17:25:51 +08:00
|
|
|
views.account_delete, name="accounts.delete"),
|
2020-08-14 00:37:11 +08:00
|
|
|
path("api/accounts",
|
|
|
|
views.api_account_list, name="api.accounts"),
|
|
|
|
path("api/accounts/options",
|
|
|
|
views.api_account_options, name="api.accounts.options"),
|
2020-06-30 20:59:24 +08:00
|
|
|
]
|