Replace absolute imports with relative imports
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
|
||||||
|
|
||||||
# Copyright (c) 2023-2024 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,7 +22,7 @@ from pathlib import Path
|
|||||||
from flask import Flask, Blueprint
|
from flask import Flask, Blueprint
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
|
||||||
from accounting.utils.user import UserUtilityInterface
|
from .utils.user import UserUtilityInterface
|
||||||
|
|
||||||
VERSION: str = "1.6.1"
|
VERSION: str = "1.6.1"
|
||||||
"""The package version."""
|
"""The package version."""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/30
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/30
|
||||||
|
|
||||||
# Copyright (c) 2023-2024 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -23,9 +23,9 @@ from typing import Any
|
|||||||
import click
|
import click
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from accounting import db
|
from .. import db
|
||||||
from accounting.models import BaseAccount, Account, AccountL10n
|
from ..models import BaseAccount, Account, AccountL10n
|
||||||
from accounting.utils.user import get_user_pk
|
from ..utils.user import get_user_pk
|
||||||
|
|
||||||
type AccountData = tuple[int, str, int, str, str, str, bool]
|
type AccountData = tuple[int, str, int, str, str, str, bool]
|
||||||
"""The format of the account data, as a list of (ID, base account code, number,
|
"""The format of the account data, as a list of (ID, base account code, number,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/31
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/31
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
from flask import abort
|
from flask import abort
|
||||||
from werkzeug.routing import BaseConverter
|
from werkzeug.routing import BaseConverter
|
||||||
|
|
||||||
from accounting.models import Account
|
from ..models import Account
|
||||||
|
|
||||||
|
|
||||||
class AccountConverter(BaseConverter):
|
class AccountConverter(BaseConverter):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/1
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/1
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -23,12 +23,12 @@ from flask_wtf import FlaskForm
|
|||||||
from wtforms import StringField, BooleanField
|
from wtforms import StringField, BooleanField
|
||||||
from wtforms.validators import DataRequired, ValidationError
|
from wtforms.validators import DataRequired, ValidationError
|
||||||
|
|
||||||
from accounting import db
|
from .. import db
|
||||||
from accounting.locale import lazy_gettext
|
from ..locale import lazy_gettext
|
||||||
from accounting.models import BaseAccount, Account
|
from ..models import BaseAccount, Account
|
||||||
from accounting.utils.random_id import new_id
|
from ..utils.random_id import new_id
|
||||||
from accounting.utils.strip_text import strip_text
|
from ..utils.strip_text import strip_text
|
||||||
from accounting.utils.user import get_current_user_pk
|
from ..utils.user import get_current_user_pk
|
||||||
|
|
||||||
|
|
||||||
class BaseAccountExists:
|
class BaseAccountExists:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/30
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/30
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from accounting.locale import gettext
|
from ..locale import gettext
|
||||||
from accounting.models import Account, AccountL10n
|
from ..models import Account, AccountL10n
|
||||||
from accounting.utils.query import parse_query_keywords
|
from ..utils.query import parse_query_keywords
|
||||||
|
|
||||||
|
|
||||||
def get_account_query() -> list[Account]:
|
def get_account_query() -> list[Account]:
|
||||||
|
|||||||
@@ -24,17 +24,17 @@ from flask import Blueprint, render_template, session, redirect, flash, \
|
|||||||
url_for, request, Response
|
url_for, request, Response
|
||||||
from werkzeug.datastructures import ImmutableMultiDict
|
from werkzeug.datastructures import ImmutableMultiDict
|
||||||
|
|
||||||
from accounting import db
|
|
||||||
from accounting.locale import lazy_gettext
|
|
||||||
from accounting.models import Account, BaseAccount
|
|
||||||
from accounting.utils.cast import s
|
|
||||||
from accounting.utils.flash_errors import flash_form_errors
|
|
||||||
from accounting.utils.next_uri import inherit_next, or_next
|
|
||||||
from accounting.utils.pagination import Pagination
|
|
||||||
from accounting.utils.permission import can_view, has_permission, can_edit
|
|
||||||
from accounting.utils.user import get_current_user_pk
|
|
||||||
from .forms import AccountForm, sort_accounts_in, AccountReorderForm
|
from .forms import AccountForm, sort_accounts_in, AccountReorderForm
|
||||||
from .queries import get_account_query
|
from .queries import get_account_query
|
||||||
|
from .. import db
|
||||||
|
from ..locale import lazy_gettext
|
||||||
|
from ..models import Account, BaseAccount
|
||||||
|
from ..utils.cast import s
|
||||||
|
from ..utils.flash_errors import flash_form_errors
|
||||||
|
from ..utils.next_uri import inherit_next, or_next
|
||||||
|
from ..utils.pagination import Pagination
|
||||||
|
from ..utils.permission import can_view, has_permission, can_edit
|
||||||
|
from ..utils.user import get_current_user_pk
|
||||||
|
|
||||||
bp: Blueprint = Blueprint("account", __name__)
|
bp: Blueprint = Blueprint("account", __name__)
|
||||||
"""The view blueprint for the account management."""
|
"""The view blueprint for the account management."""
|
||||||
|
|||||||
@@ -21,10 +21,9 @@ import csv
|
|||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from accounting import data_dir
|
from .. import db, data_dir
|
||||||
from accounting import db
|
from ..models import BaseAccount, BaseAccountL10n
|
||||||
from accounting.models import BaseAccount, BaseAccountL10n
|
from ..utils.title_case import title_case
|
||||||
from accounting.utils.title_case import title_case
|
|
||||||
|
|
||||||
|
|
||||||
def init_base_accounts_command() -> None:
|
def init_base_accounts_command() -> None:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/1
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/1
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
from flask import abort
|
from flask import abort
|
||||||
from werkzeug.routing import BaseConverter
|
from werkzeug.routing import BaseConverter
|
||||||
|
|
||||||
from accounting import db
|
from .. import db
|
||||||
from accounting.models import BaseAccount
|
from ..models import BaseAccount
|
||||||
|
|
||||||
|
|
||||||
class BaseAccountConverter(BaseConverter):
|
class BaseAccountConverter(BaseConverter):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/26
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/26
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from accounting.models import BaseAccount, BaseAccountL10n
|
from ..models import BaseAccount, BaseAccountL10n
|
||||||
from accounting.utils.query import parse_query_keywords
|
from ..utils.query import parse_query_keywords
|
||||||
|
|
||||||
|
|
||||||
def get_base_account_query() -> list[BaseAccount]:
|
def get_base_account_query() -> list[BaseAccount]:
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
"""
|
"""
|
||||||
from flask import Blueprint, render_template
|
from flask import Blueprint, render_template
|
||||||
|
|
||||||
from accounting.models import BaseAccount
|
|
||||||
from accounting.utils.pagination import Pagination
|
|
||||||
from accounting.utils.permission import has_permission, can_view
|
|
||||||
from .queries import get_base_account_query
|
from .queries import get_base_account_query
|
||||||
|
from ..models import BaseAccount
|
||||||
|
from ..utils.pagination import Pagination
|
||||||
|
from ..utils.permission import has_permission, can_view
|
||||||
|
|
||||||
bp: Blueprint = Blueprint("base-account", __name__)
|
bp: Blueprint = Blueprint("base-account", __name__)
|
||||||
"""The view blueprint for the base account management."""
|
"""The view blueprint for the base account management."""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/10
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/10
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -20,16 +20,16 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
import sqlalchemy as sa
|
||||||
from flask.cli import with_appcontext
|
from flask.cli import with_appcontext
|
||||||
|
|
||||||
from accounting import db
|
from . import db
|
||||||
from accounting.account import init_accounts_command
|
from .account import init_accounts_command
|
||||||
from accounting.base_account import init_base_accounts_command
|
from .base_account import init_base_accounts_command
|
||||||
from accounting.currency import init_currencies_command
|
from .currency import init_currencies_command
|
||||||
from accounting.models import BaseAccount, Account
|
from .models import BaseAccount, Account
|
||||||
from accounting.utils.title_case import title_case
|
from .utils.title_case import title_case
|
||||||
from accounting.utils.user import has_user, get_user_pk
|
from .utils.user import has_user, get_user_pk
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
def __validate_username(ctx: click.core.Context, param: click.core.Option,
|
def __validate_username(ctx: click.core.Context, param: click.core.Option,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/6
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/6
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,9 +22,9 @@ from typing import Any
|
|||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from accounting import db, data_dir
|
from .. import db, data_dir
|
||||||
from accounting.models import Currency, CurrencyL10n
|
from ..models import Currency, CurrencyL10n
|
||||||
from accounting.utils.user import get_user_pk
|
from ..utils.user import get_user_pk
|
||||||
|
|
||||||
|
|
||||||
def init_currencies_command(username: str) -> None:
|
def init_currencies_command(username: str) -> None:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/6
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/6
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
from flask import abort
|
from flask import abort
|
||||||
from werkzeug.routing import BaseConverter
|
from werkzeug.routing import BaseConverter
|
||||||
|
|
||||||
from accounting import db
|
from .. import db
|
||||||
from accounting.models import Currency
|
from ..models import Currency
|
||||||
|
|
||||||
|
|
||||||
class CurrencyConverter(BaseConverter):
|
class CurrencyConverter(BaseConverter):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/6
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/6
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -21,11 +21,11 @@ from flask_wtf import FlaskForm
|
|||||||
from wtforms import StringField, ValidationError
|
from wtforms import StringField, ValidationError
|
||||||
from wtforms.validators import DataRequired, Regexp, NoneOf
|
from wtforms.validators import DataRequired, Regexp, NoneOf
|
||||||
|
|
||||||
from accounting import db
|
from .. import db
|
||||||
from accounting.locale import lazy_gettext
|
from ..locale import lazy_gettext
|
||||||
from accounting.models import Currency
|
from ..models import Currency
|
||||||
from accounting.utils.strip_text import strip_text
|
from ..utils.strip_text import strip_text
|
||||||
from accounting.utils.user import get_current_user_pk
|
from ..utils.user import get_current_user_pk
|
||||||
|
|
||||||
|
|
||||||
class CodeUnique:
|
class CodeUnique:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/6
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/6
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from accounting.models import Currency, CurrencyL10n
|
from ..models import Currency, CurrencyL10n
|
||||||
from accounting.utils.query import parse_query_keywords
|
from ..utils.query import parse_query_keywords
|
||||||
|
|
||||||
|
|
||||||
def get_currency_query() -> list[Currency]:
|
def get_currency_query() -> list[Currency]:
|
||||||
|
|||||||
@@ -24,17 +24,17 @@ from flask import Blueprint, render_template, redirect, session, request, \
|
|||||||
flash, url_for, Response
|
flash, url_for, Response
|
||||||
from werkzeug.datastructures import ImmutableMultiDict
|
from werkzeug.datastructures import ImmutableMultiDict
|
||||||
|
|
||||||
from accounting import db
|
|
||||||
from accounting.locale import lazy_gettext
|
|
||||||
from accounting.models import Currency
|
|
||||||
from accounting.utils.cast import s
|
|
||||||
from accounting.utils.flash_errors import flash_form_errors
|
|
||||||
from accounting.utils.next_uri import inherit_next, or_next
|
|
||||||
from accounting.utils.pagination import Pagination
|
|
||||||
from accounting.utils.permission import has_permission, can_view, can_edit
|
|
||||||
from accounting.utils.user import get_current_user_pk
|
|
||||||
from .forms import CurrencyForm
|
from .forms import CurrencyForm
|
||||||
from .queries import get_currency_query
|
from .queries import get_currency_query
|
||||||
|
from .. import db
|
||||||
|
from ..locale import lazy_gettext
|
||||||
|
from ..models import Currency
|
||||||
|
from ..utils.cast import s
|
||||||
|
from ..utils.flash_errors import flash_form_errors
|
||||||
|
from ..utils.next_uri import inherit_next, or_next
|
||||||
|
from ..utils.pagination import Pagination
|
||||||
|
from ..utils.permission import has_permission, can_view, can_edit
|
||||||
|
from ..utils.user import get_current_user_pk
|
||||||
|
|
||||||
bp: Blueprint = Blueprint("currency", __name__)
|
bp: Blueprint = Blueprint("currency", __name__)
|
||||||
"""The view blueprint for the currency management."""
|
"""The view blueprint for the currency management."""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/22
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/22
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -24,10 +24,9 @@ from flask_wtf import FlaskForm
|
|||||||
from wtforms import StringField, ValidationError
|
from wtforms import StringField, ValidationError
|
||||||
from wtforms.validators import DataRequired
|
from wtforms.validators import DataRequired
|
||||||
|
|
||||||
from accounting import db
|
from . import db
|
||||||
from accounting.locale import lazy_gettext
|
from .locale import lazy_gettext
|
||||||
from accounting.models import Currency, Account
|
from .models import Currency, Account
|
||||||
|
|
||||||
|
|
||||||
ACCOUNT_REQUIRED: DataRequired = DataRequired(
|
ACCOUNT_REQUIRED: DataRequired = DataRequired(
|
||||||
lazy_gettext("Please select the account."))
|
lazy_gettext("Please select the account."))
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/19
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/19
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,9 +22,9 @@ import datetime as dt
|
|||||||
from flask import abort
|
from flask import abort
|
||||||
from werkzeug.routing import BaseConverter
|
from werkzeug.routing import BaseConverter
|
||||||
|
|
||||||
from accounting import db
|
from .. import db
|
||||||
from accounting.models import JournalEntry
|
from ..models import JournalEntry
|
||||||
from accounting.utils.journal_entry_types import JournalEntryType
|
from ..utils.journal_entry_types import JournalEntryType
|
||||||
|
|
||||||
|
|
||||||
class JournalEntryConverter(BaseConverter):
|
class JournalEntryConverter(BaseConverter):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/10
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/10
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -26,13 +26,13 @@ from wtforms import StringField, ValidationError, FieldList, IntegerField, \
|
|||||||
BooleanField, FormField
|
BooleanField, FormField
|
||||||
from wtforms.validators import DataRequired
|
from wtforms.validators import DataRequired
|
||||||
|
|
||||||
from accounting import db
|
|
||||||
from accounting.forms import CurrencyExists
|
|
||||||
from accounting.locale import lazy_gettext
|
|
||||||
from accounting.models import JournalEntryLineItem
|
|
||||||
from accounting.utils.offset_alias import offset_alias
|
|
||||||
from accounting.utils.strip_text import strip_text
|
|
||||||
from .line_item import LineItemForm, CreditLineItemForm, DebitLineItemForm
|
from .line_item import LineItemForm, CreditLineItemForm, DebitLineItemForm
|
||||||
|
from ... import db
|
||||||
|
from ...forms import CurrencyExists
|
||||||
|
from ...locale import lazy_gettext
|
||||||
|
from ...models import JournalEntryLineItem
|
||||||
|
from ...utils.offset_alias import offset_alias
|
||||||
|
from ...utils.strip_text import strip_text
|
||||||
|
|
||||||
CURRENCY_REQUIRED: DataRequired = DataRequired(
|
CURRENCY_REQUIRED: DataRequired = DataRequired(
|
||||||
lazy_gettext("Please select the currency."))
|
lazy_gettext("Please select the currency."))
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/18
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/18
|
||||||
|
|
||||||
# Copyright (c) 2023-2024 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -28,21 +28,20 @@ from wtforms import DateField, FieldList, FormField, TextAreaField, \
|
|||||||
BooleanField
|
BooleanField
|
||||||
from wtforms.validators import DataRequired, ValidationError
|
from wtforms.validators import DataRequired, ValidationError
|
||||||
|
|
||||||
from accounting import db
|
|
||||||
from accounting.journal_entry.utils.account_option import AccountOption
|
|
||||||
from accounting.journal_entry.utils.description_editor import DescriptionEditor
|
|
||||||
from accounting.journal_entry.utils.original_line_items import \
|
|
||||||
get_selectable_original_line_items
|
|
||||||
from accounting.locale import lazy_gettext
|
|
||||||
from accounting.models import JournalEntry, Account, JournalEntryLineItem, \
|
|
||||||
JournalEntryCurrency
|
|
||||||
from accounting.utils.random_id import new_id
|
|
||||||
from accounting.utils.strip_text import strip_multiline_text
|
|
||||||
from accounting.utils.user import get_current_user_pk
|
|
||||||
from .currency import CurrencyForm, CashReceiptCurrencyForm, \
|
from .currency import CurrencyForm, CashReceiptCurrencyForm, \
|
||||||
CashDisbursementCurrencyForm, TransferCurrencyForm
|
CashDisbursementCurrencyForm, TransferCurrencyForm
|
||||||
from .line_item import LineItemForm, DebitLineItemForm, CreditLineItemForm
|
from .line_item import LineItemForm, DebitLineItemForm, CreditLineItemForm
|
||||||
from .reorder import sort_journal_entries_in
|
from .reorder import sort_journal_entries_in
|
||||||
|
from ..utils.account_option import AccountOption
|
||||||
|
from ..utils.description_editor import DescriptionEditor
|
||||||
|
from ..utils.original_line_items import get_selectable_original_line_items
|
||||||
|
from ... import db
|
||||||
|
from ...locale import lazy_gettext
|
||||||
|
from ...models import JournalEntry, Account, JournalEntryLineItem, \
|
||||||
|
JournalEntryCurrency
|
||||||
|
from ...utils.random_id import new_id
|
||||||
|
from ...utils.strip_text import strip_multiline_text
|
||||||
|
from ...utils.user import get_current_user_pk
|
||||||
|
|
||||||
DATE_REQUIRED: DataRequired = DataRequired(
|
DATE_REQUIRED: DataRequired = DataRequired(
|
||||||
lazy_gettext("Please fill in the date."))
|
lazy_gettext("Please fill in the date."))
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/10
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/10
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -27,15 +27,15 @@ from sqlalchemy.orm import selectinload
|
|||||||
from wtforms import StringField, ValidationError, DecimalField, IntegerField
|
from wtforms import StringField, ValidationError, DecimalField, IntegerField
|
||||||
from wtforms.validators import Optional
|
from wtforms.validators import Optional
|
||||||
|
|
||||||
from accounting import db
|
from ... import db
|
||||||
from accounting.forms import ACCOUNT_REQUIRED, AccountExists, IsDebitAccount, \
|
from ...forms import ACCOUNT_REQUIRED, AccountExists, IsDebitAccount, \
|
||||||
IsCreditAccount
|
IsCreditAccount
|
||||||
from accounting.locale import lazy_gettext
|
from ...locale import lazy_gettext
|
||||||
from accounting.models import Account, JournalEntry, JournalEntryLineItem
|
from ...models import Account, JournalEntry, JournalEntryLineItem
|
||||||
from accounting.template_filters import format_amount
|
from ...template_filters import format_amount
|
||||||
from accounting.utils.random_id import new_id
|
from ...utils.random_id import new_id
|
||||||
from accounting.utils.strip_text import strip_text
|
from ...utils.strip_text import strip_text
|
||||||
from accounting.utils.user import get_current_user_pk
|
from ...utils.user import get_current_user_pk
|
||||||
|
|
||||||
|
|
||||||
class OriginalLineItemExists:
|
class OriginalLineItemExists:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/10
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/10
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,8 +22,8 @@ import datetime as dt
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from accounting import db
|
from ... import db
|
||||||
from accounting.models import JournalEntry
|
from ...models import JournalEntry
|
||||||
|
|
||||||
|
|
||||||
def sort_journal_entries_in(date: dt.date, exclude: int | None = None) -> None:
|
def sort_journal_entries_in(date: dt.date, exclude: int | None = None) -> None:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/10
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/10
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
"""The account option for the journal entry management.
|
"""The account option for the journal entry management.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from accounting.models import Account
|
from ...models import Account
|
||||||
|
|
||||||
|
|
||||||
class AccountOption:
|
class AccountOption:
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ from typing import Literal
|
|||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from accounting import db
|
from ... import db
|
||||||
from accounting.models import Account, JournalEntryLineItem
|
from ...models import Account, JournalEntryLineItem
|
||||||
from accounting.utils.options import options, Recurring
|
from ...utils.options import options, Recurring
|
||||||
|
|
||||||
|
|
||||||
class DescriptionAccount:
|
class DescriptionAccount:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/19
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/19
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -23,13 +23,12 @@ from typing import Type
|
|||||||
from flask import render_template, request, abort
|
from flask import render_template, request, abort
|
||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
|
|
||||||
from accounting.journal_entry.forms import JournalEntryForm, \
|
from ..forms import JournalEntryForm, CashReceiptJournalEntryForm, \
|
||||||
CashReceiptJournalEntryForm, CashDisbursementJournalEntryForm, \
|
CashDisbursementJournalEntryForm, TransferJournalEntryForm
|
||||||
TransferJournalEntryForm
|
from ..forms.line_item import LineItemForm
|
||||||
from accounting.journal_entry.forms.line_item import LineItemForm
|
from ...models import JournalEntry
|
||||||
from accounting.models import JournalEntry
|
from ...template_globals import default_currency_code
|
||||||
from accounting.template_globals import default_currency_code
|
from ...utils.journal_entry_types import JournalEntryType
|
||||||
from accounting.utils.journal_entry_types import JournalEntryType
|
|
||||||
|
|
||||||
|
|
||||||
class JournalEntryOperator(ABC):
|
class JournalEntryOperator(ABC):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/10
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/10
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,9 +22,9 @@ from decimal import Decimal
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from accounting import db
|
from ... import db
|
||||||
from accounting.models import Account, JournalEntry, JournalEntryLineItem
|
from ...models import Account, JournalEntry, JournalEntryLineItem
|
||||||
from accounting.utils.offset_alias import offset_alias
|
from ...utils.offset_alias import offset_alias
|
||||||
|
|
||||||
|
|
||||||
def get_selectable_original_line_items(
|
def get_selectable_original_line_items(
|
||||||
|
|||||||
@@ -25,21 +25,21 @@ from flask import Blueprint, render_template, session, redirect, request, \
|
|||||||
flash, url_for, Response
|
flash, url_for, Response
|
||||||
from werkzeug.datastructures import ImmutableMultiDict
|
from werkzeug.datastructures import ImmutableMultiDict
|
||||||
|
|
||||||
from accounting import db
|
|
||||||
from accounting.locale import lazy_gettext
|
|
||||||
from accounting.models import JournalEntry
|
|
||||||
from accounting.utils.cast import s
|
|
||||||
from accounting.utils.flash_errors import flash_form_errors
|
|
||||||
from accounting.utils.journal_entry_types import JournalEntryType
|
|
||||||
from accounting.utils.next_uri import inherit_next, or_next
|
|
||||||
from accounting.utils.permission import has_permission, can_view, can_edit
|
|
||||||
from accounting.utils.timezone import get_tz_today
|
|
||||||
from accounting.utils.user import get_current_user_pk
|
|
||||||
from .forms import sort_journal_entries_in, JournalEntryReorderForm
|
from .forms import sort_journal_entries_in, JournalEntryReorderForm
|
||||||
from .template_filters import with_type, to_transfer, format_amount_input, \
|
from .template_filters import with_type, to_transfer, format_amount_input, \
|
||||||
text2html
|
text2html
|
||||||
from .utils.operators import JournalEntryOperator, JOURNAL_ENTRY_TYPE_TO_OP, \
|
from .utils.operators import JournalEntryOperator, JOURNAL_ENTRY_TYPE_TO_OP, \
|
||||||
get_journal_entry_op
|
get_journal_entry_op
|
||||||
|
from .. import db
|
||||||
|
from ..locale import lazy_gettext
|
||||||
|
from ..models import JournalEntry
|
||||||
|
from ..utils.cast import s
|
||||||
|
from ..utils.flash_errors import flash_form_errors
|
||||||
|
from ..utils.journal_entry_types import JournalEntryType
|
||||||
|
from ..utils.next_uri import inherit_next, or_next
|
||||||
|
from ..utils.permission import has_permission, can_view, can_edit
|
||||||
|
from ..utils.timezone import get_tz_today
|
||||||
|
from ..utils.user import get_current_user_pk
|
||||||
|
|
||||||
bp: Blueprint = Blueprint("journal-entry", __name__)
|
bp: Blueprint = Blueprint("journal-entry", __name__)
|
||||||
"""The view blueprint for the journal entry management."""
|
"""The view blueprint for the journal entry management."""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -30,9 +30,9 @@ from flask_babel import get_locale, get_babel
|
|||||||
from sqlalchemy import text
|
from sqlalchemy import text
|
||||||
from sqlalchemy.orm import Mapped, mapped_column
|
from sqlalchemy.orm import Mapped, mapped_column
|
||||||
|
|
||||||
from accounting import db
|
from . import db
|
||||||
from accounting.locale import gettext
|
from .locale import gettext
|
||||||
from accounting.utils.user import user_cls, user_pk_column
|
from .utils.user import user_cls, user_pk_column
|
||||||
|
|
||||||
|
|
||||||
class BaseAccount(db.Model):
|
class BaseAccount(db.Model):
|
||||||
@@ -462,7 +462,7 @@ class Currency(db.Model):
|
|||||||
|
|
||||||
:return: True if the currency can be deleted, or False otherwise.
|
:return: True if the currency can be deleted, or False otherwise.
|
||||||
"""
|
"""
|
||||||
from accounting.template_globals import default_currency_code
|
from .template_globals import default_currency_code
|
||||||
if self.code == default_currency_code():
|
if self.code == default_currency_code():
|
||||||
return False
|
return False
|
||||||
return len(self.line_items) == 0
|
return len(self.line_items) == 0
|
||||||
@@ -699,7 +699,7 @@ class JournalEntryLineItem(db.Model):
|
|||||||
:return: The string representation of the line item.
|
:return: The string representation of the line item.
|
||||||
"""
|
"""
|
||||||
if not hasattr(self, "__str"):
|
if not hasattr(self, "__str"):
|
||||||
from accounting.template_filters import format_date, format_amount
|
from .template_filters import format_date, format_amount
|
||||||
setattr(self, "__str",
|
setattr(self, "__str",
|
||||||
gettext("%(date)s %(description)s %(amount)s",
|
gettext("%(date)s %(description)s %(amount)s",
|
||||||
date=format_date(self.journal_entry.date),
|
date=format_date(self.journal_entry.date),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/22
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/22
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -23,13 +23,13 @@ from flask_wtf import FlaskForm
|
|||||||
from wtforms import StringField, FieldList, FormField, IntegerField
|
from wtforms import StringField, FieldList, FormField, IntegerField
|
||||||
from wtforms.validators import DataRequired, ValidationError
|
from wtforms.validators import DataRequired, ValidationError
|
||||||
|
|
||||||
from accounting.forms import ACCOUNT_REQUIRED, CurrencyExists, AccountExists, \
|
from ..forms import ACCOUNT_REQUIRED, CurrencyExists, AccountExists, \
|
||||||
IsDebitAccount, IsCreditAccount
|
IsDebitAccount, IsCreditAccount
|
||||||
from accounting.locale import lazy_gettext
|
from ..locale import lazy_gettext
|
||||||
from accounting.models import Account
|
from ..models import Account
|
||||||
from accounting.utils.current_account import CurrentAccount
|
from ..utils.current_account import CurrentAccount
|
||||||
from accounting.utils.options import Options
|
from ..utils.options import Options
|
||||||
from accounting.utils.strip_text import strip_text
|
from ..utils.strip_text import strip_text
|
||||||
|
|
||||||
|
|
||||||
class CurrentAccountExists:
|
class CurrentAccountExists:
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ from flask import Blueprint, render_template, redirect, session, request, \
|
|||||||
flash, url_for, Response
|
flash, url_for, Response
|
||||||
from werkzeug.datastructures import ImmutableMultiDict
|
from werkzeug.datastructures import ImmutableMultiDict
|
||||||
|
|
||||||
from accounting.locale import lazy_gettext
|
|
||||||
from accounting.utils.cast import s
|
|
||||||
from accounting.utils.flash_errors import flash_form_errors
|
|
||||||
from accounting.utils.next_uri import inherit_next
|
|
||||||
from accounting.utils.options import options
|
|
||||||
from accounting.utils.permission import has_permission, can_admin
|
|
||||||
from .forms import OptionForm
|
from .forms import OptionForm
|
||||||
|
from ..locale import lazy_gettext
|
||||||
|
from ..utils.cast import s
|
||||||
|
from ..utils.flash_errors import flash_form_errors
|
||||||
|
from ..utils.next_uri import inherit_next
|
||||||
|
from ..utils.options import options
|
||||||
|
from ..utils.permission import has_permission, can_admin
|
||||||
|
|
||||||
bp: Blueprint = Blueprint("option", __name__)
|
bp: Blueprint = Blueprint("option", __name__)
|
||||||
"""The view blueprint for the currency management."""
|
"""The view blueprint for the currency management."""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/3
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/3
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,9 +22,9 @@ import re
|
|||||||
from flask import abort
|
from flask import abort
|
||||||
from werkzeug.routing import BaseConverter
|
from werkzeug.routing import BaseConverter
|
||||||
|
|
||||||
from accounting.models import Account
|
|
||||||
from accounting.utils.current_account import CurrentAccount
|
|
||||||
from .period import Period, get_period
|
from .period import Period, get_period
|
||||||
|
from ..models import Account
|
||||||
|
from ..utils.current_account import CurrentAccount
|
||||||
|
|
||||||
|
|
||||||
class PeriodConverter(BaseConverter):
|
class PeriodConverter(BaseConverter):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/4
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/4
|
||||||
|
|
||||||
# Copyright (c) 2023-2024 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -23,11 +23,11 @@ This file is largely taken from the NanoParma ERP project, first written in
|
|||||||
import datetime as dt
|
import datetime as dt
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
|
||||||
from accounting.models import JournalEntry
|
|
||||||
from accounting.utils.timezone import get_tz_today
|
|
||||||
from .period import Period
|
from .period import Period
|
||||||
from .shortcuts import ThisMonth, LastMonth, SinceLastMonth, ThisYear, \
|
from .shortcuts import ThisMonth, LastMonth, SinceLastMonth, ThisYear, \
|
||||||
LastYear, Today, Yesterday, AllTime, TemplatePeriod, YearPeriod
|
LastYear, Today, Yesterday, AllTime, TemplatePeriod, YearPeriod
|
||||||
|
from ...models import JournalEntry
|
||||||
|
from ...utils.timezone import get_tz_today
|
||||||
|
|
||||||
|
|
||||||
class PeriodChooser:
|
class PeriodChooser:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/4
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/4
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"""
|
"""
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
|
||||||
from accounting.locale import gettext
|
from ...locale import gettext
|
||||||
|
|
||||||
|
|
||||||
def get_desc(start: dt.date | None, end: dt.date | None) -> str:
|
def get_desc(start: dt.date | None, end: dt.date | None) -> str:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/4
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/4
|
||||||
|
|
||||||
# Copyright (c) 2023-2024 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
"""
|
"""
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
|
||||||
from accounting.locale import gettext
|
|
||||||
from accounting.utils.timezone import get_tz_today
|
|
||||||
from .month_end import month_end
|
from .month_end import month_end
|
||||||
from .period import Period
|
from .period import Period
|
||||||
|
from ...locale import gettext
|
||||||
|
from ...utils.timezone import get_tz_today
|
||||||
|
|
||||||
|
|
||||||
class ThisMonth(Period):
|
class ThisMonth(Period):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,20 +22,18 @@ from decimal import Decimal
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from flask import render_template, Response
|
from flask import render_template, Response
|
||||||
|
|
||||||
from accounting import db
|
from ..period import Period, PeriodChooser
|
||||||
from accounting.locale import gettext
|
from ..utils.base_page_params import BasePageParams
|
||||||
from accounting.models import Currency, BaseAccount, Account, JournalEntry, \
|
from ..utils.base_report import BaseReport
|
||||||
|
from ..utils.csv_export import BaseCSVRow, csv_download, period_spec
|
||||||
|
from ..utils.option_link import OptionLink
|
||||||
|
from ..utils.report_chooser import ReportChooser
|
||||||
|
from ..utils.report_type import ReportType
|
||||||
|
from ..utils.urls import ledger_url, balance_sheet_url, income_statement_url
|
||||||
|
from ... import db
|
||||||
|
from ...locale import gettext
|
||||||
|
from ...models import Currency, BaseAccount, Account, JournalEntry, \
|
||||||
JournalEntryLineItem
|
JournalEntryLineItem
|
||||||
from accounting.report.period import Period, PeriodChooser
|
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
|
||||||
from accounting.report.utils.base_report import BaseReport
|
|
||||||
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
|
|
||||||
period_spec
|
|
||||||
from accounting.report.utils.option_link import OptionLink
|
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
|
||||||
from accounting.report.utils.report_type import ReportType
|
|
||||||
from accounting.report.utils.urls import ledger_url, balance_sheet_url, \
|
|
||||||
income_statement_url
|
|
||||||
|
|
||||||
|
|
||||||
class ReportAccount:
|
class ReportAccount:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -24,21 +24,19 @@ import sqlalchemy as sa
|
|||||||
from flask import url_for, render_template, Response
|
from flask import url_for, render_template, Response
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from accounting import db
|
from ..period import Period, PeriodChooser
|
||||||
from accounting.locale import gettext
|
from ..utils.base_page_params import BasePageParams
|
||||||
from accounting.models import Currency, Account, JournalEntry, \
|
from ..utils.base_report import BaseReport
|
||||||
JournalEntryLineItem
|
from ..utils.csv_export import BaseCSVRow, csv_download, period_spec
|
||||||
from accounting.report.period import Period, PeriodChooser
|
from ..utils.option_link import OptionLink
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
from ..utils.report_chooser import ReportChooser
|
||||||
from accounting.report.utils.base_report import BaseReport
|
from ..utils.report_type import ReportType
|
||||||
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
|
from ..utils.urls import income_expenses_url
|
||||||
period_spec
|
from ... import db
|
||||||
from accounting.report.utils.option_link import OptionLink
|
from ...locale import gettext
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
from ...models import Currency, Account, JournalEntry, JournalEntryLineItem
|
||||||
from accounting.report.utils.report_type import ReportType
|
from ...utils.current_account import CurrentAccount
|
||||||
from accounting.report.utils.urls import income_expenses_url
|
from ...utils.pagination import Pagination
|
||||||
from accounting.utils.current_account import CurrentAccount
|
|
||||||
from accounting.utils.pagination import Pagination
|
|
||||||
|
|
||||||
|
|
||||||
class ReportLineItem:
|
class ReportLineItem:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,19 +22,18 @@ from decimal import Decimal
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from flask import render_template, Response
|
from flask import render_template, Response
|
||||||
|
|
||||||
from accounting import db
|
from ..period import Period, PeriodChooser
|
||||||
from accounting.locale import gettext
|
from ..utils.base_page_params import BasePageParams
|
||||||
from accounting.models import Currency, BaseAccount, Account, JournalEntry, \
|
from ..utils.base_report import BaseReport
|
||||||
|
from ..utils.csv_export import BaseCSVRow, csv_download, period_spec
|
||||||
|
from ..utils.option_link import OptionLink
|
||||||
|
from ..utils.report_chooser import ReportChooser
|
||||||
|
from ..utils.report_type import ReportType
|
||||||
|
from ..utils.urls import ledger_url, income_statement_url
|
||||||
|
from ... import db
|
||||||
|
from ...locale import gettext
|
||||||
|
from ...models import Currency, BaseAccount, Account, JournalEntry, \
|
||||||
JournalEntryLineItem
|
JournalEntryLineItem
|
||||||
from accounting.report.period import Period, PeriodChooser
|
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
|
||||||
from accounting.report.utils.base_report import BaseReport
|
|
||||||
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
|
|
||||||
period_spec
|
|
||||||
from accounting.report.utils.option_link import OptionLink
|
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
|
||||||
from accounting.report.utils.report_type import ReportType
|
|
||||||
from accounting.report.utils.urls import ledger_url, income_statement_url
|
|
||||||
|
|
||||||
|
|
||||||
class ReportAccount:
|
class ReportAccount:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -24,18 +24,16 @@ import sqlalchemy as sa
|
|||||||
from flask import render_template, Response
|
from flask import render_template, Response
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from accounting.locale import gettext
|
from ..period import Period, PeriodChooser
|
||||||
from accounting.models import Currency, Account, JournalEntry, \
|
from ..utils.base_page_params import BasePageParams
|
||||||
JournalEntryLineItem
|
from ..utils.base_report import BaseReport
|
||||||
from accounting.report.period import Period, PeriodChooser
|
from ..utils.csv_export import BaseCSVRow, csv_download, period_spec
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
from ..utils.report_chooser import ReportChooser
|
||||||
from accounting.report.utils.base_report import BaseReport
|
from ..utils.report_type import ReportType
|
||||||
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
|
from ..utils.urls import journal_url
|
||||||
period_spec
|
from ...locale import gettext
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
from ...models import Currency, Account, JournalEntry, JournalEntryLineItem
|
||||||
from accounting.report.utils.report_type import ReportType
|
from ...utils.pagination import Pagination
|
||||||
from accounting.report.utils.urls import journal_url
|
|
||||||
from accounting.utils.pagination import Pagination
|
|
||||||
|
|
||||||
|
|
||||||
class ReportLineItem:
|
class ReportLineItem:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -24,20 +24,18 @@ import sqlalchemy as sa
|
|||||||
from flask import url_for, render_template, Response
|
from flask import url_for, render_template, Response
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from accounting import db
|
from ..period import Period, PeriodChooser
|
||||||
from accounting.locale import gettext
|
from ..utils.base_page_params import BasePageParams
|
||||||
from accounting.models import Currency, Account, JournalEntry, \
|
from ..utils.base_report import BaseReport
|
||||||
JournalEntryLineItem
|
from ..utils.csv_export import BaseCSVRow, csv_download, period_spec
|
||||||
from accounting.report.period import Period, PeriodChooser
|
from ..utils.option_link import OptionLink
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
from ..utils.report_chooser import ReportChooser
|
||||||
from accounting.report.utils.base_report import BaseReport
|
from ..utils.report_type import ReportType
|
||||||
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
|
from ..utils.urls import ledger_url
|
||||||
period_spec
|
from ... import db
|
||||||
from accounting.report.utils.option_link import OptionLink
|
from ...locale import gettext
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
from ...models import Currency, Account, JournalEntry, JournalEntryLineItem
|
||||||
from accounting.report.utils.report_type import ReportType
|
from ...utils.pagination import Pagination
|
||||||
from accounting.report.utils.urls import ledger_url
|
|
||||||
from accounting.utils.pagination import Pagination
|
|
||||||
|
|
||||||
|
|
||||||
class ReportLineItem:
|
class ReportLineItem:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/8
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/8
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -24,17 +24,17 @@ import sqlalchemy as sa
|
|||||||
from flask import Response, render_template, request
|
from flask import Response, render_template, request
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from accounting.locale import gettext
|
|
||||||
from accounting.models import Currency, CurrencyL10n, Account, AccountL10n, \
|
|
||||||
JournalEntry, JournalEntryLineItem
|
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
|
||||||
from accounting.report.utils.base_report import BaseReport
|
|
||||||
from accounting.report.utils.csv_export import csv_download
|
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
|
||||||
from accounting.report.utils.report_type import ReportType
|
|
||||||
from accounting.utils.pagination import Pagination
|
|
||||||
from accounting.utils.query import parse_query_keywords
|
|
||||||
from .journal import get_csv_rows
|
from .journal import get_csv_rows
|
||||||
|
from ..utils.base_page_params import BasePageParams
|
||||||
|
from ..utils.base_report import BaseReport
|
||||||
|
from ..utils.csv_export import csv_download
|
||||||
|
from ..utils.report_chooser import ReportChooser
|
||||||
|
from ..utils.report_type import ReportType
|
||||||
|
from ...locale import gettext
|
||||||
|
from ...models import Currency, CurrencyL10n, Account, AccountL10n, \
|
||||||
|
JournalEntry, JournalEntryLineItem
|
||||||
|
from ...utils.pagination import Pagination
|
||||||
|
from ...utils.query import parse_query_keywords
|
||||||
|
|
||||||
|
|
||||||
class LineItemCollector:
|
class LineItemCollector:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,19 +22,17 @@ from decimal import Decimal
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from flask import Response, render_template
|
from flask import Response, render_template
|
||||||
|
|
||||||
from accounting import db
|
from ..period import Period, PeriodChooser
|
||||||
from accounting.locale import gettext
|
from ..utils.base_page_params import BasePageParams
|
||||||
from accounting.models import Currency, Account, JournalEntry, \
|
from ..utils.base_report import BaseReport
|
||||||
JournalEntryLineItem
|
from ..utils.csv_export import BaseCSVRow, csv_download, period_spec
|
||||||
from accounting.report.period import Period, PeriodChooser
|
from ..utils.option_link import OptionLink
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
from ..utils.report_chooser import ReportChooser
|
||||||
from accounting.report.utils.base_report import BaseReport
|
from ..utils.report_type import ReportType
|
||||||
from accounting.report.utils.csv_export import BaseCSVRow, csv_download, \
|
from ..utils.urls import ledger_url, trial_balance_url
|
||||||
period_spec
|
from ... import db
|
||||||
from accounting.report.utils.option_link import OptionLink
|
from ...locale import gettext
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
from ...models import Currency, Account, JournalEntry, JournalEntryLineItem
|
||||||
from accounting.report.utils.report_type import ReportType
|
|
||||||
from accounting.report.utils.urls import ledger_url, trial_balance_url
|
|
||||||
|
|
||||||
|
|
||||||
class ReportAccount:
|
class ReportAccount:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -23,19 +23,17 @@ from decimal import Decimal
|
|||||||
from flask import render_template, Response
|
from flask import render_template, Response
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from accounting.locale import gettext
|
from ..utils.base_page_params import BasePageParams
|
||||||
from accounting.models import Currency, Account, JournalEntry, \
|
from ..utils.base_report import BaseReport
|
||||||
JournalEntryLineItem
|
from ..utils.csv_export import BaseCSVRow, csv_download
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
from ..utils.option_link import OptionLink
|
||||||
from accounting.report.utils.base_report import BaseReport
|
from ..utils.report_chooser import ReportChooser
|
||||||
from accounting.report.utils.csv_export import BaseCSVRow, csv_download
|
from ..utils.report_type import ReportType
|
||||||
from accounting.report.utils.option_link import OptionLink
|
from ..utils.unapplied import get_accounts_with_unapplied, get_net_balances
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
from ..utils.urls import unapplied_url
|
||||||
from accounting.report.utils.report_type import ReportType
|
from ...locale import gettext
|
||||||
from accounting.report.utils.unapplied import get_accounts_with_unapplied, \
|
from ...models import Currency, Account, JournalEntry, JournalEntryLineItem
|
||||||
get_net_balances
|
from ...utils.pagination import Pagination
|
||||||
from accounting.report.utils.urls import unapplied_url
|
|
||||||
from accounting.utils.pagination import Pagination
|
|
||||||
|
|
||||||
|
|
||||||
class CSVRow(BaseCSVRow):
|
class CSVRow(BaseCSVRow):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,16 +22,16 @@ from decimal import Decimal
|
|||||||
|
|
||||||
from flask import render_template, Response
|
from flask import render_template, Response
|
||||||
|
|
||||||
from accounting.locale import gettext
|
from ..utils.base_page_params import BasePageParams
|
||||||
from accounting.models import Currency, Account
|
from ..utils.base_report import BaseReport
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
from ..utils.csv_export import BaseCSVRow, csv_download
|
||||||
from accounting.report.utils.base_report import BaseReport
|
from ..utils.option_link import OptionLink
|
||||||
from accounting.report.utils.csv_export import BaseCSVRow, csv_download
|
from ..utils.report_chooser import ReportChooser
|
||||||
from accounting.report.utils.option_link import OptionLink
|
from ..utils.report_type import ReportType
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
from ..utils.unapplied import get_accounts_with_unapplied
|
||||||
from accounting.report.utils.report_type import ReportType
|
from ..utils.urls import unapplied_url
|
||||||
from accounting.report.utils.unapplied import get_accounts_with_unapplied
|
from ...locale import gettext
|
||||||
from accounting.report.utils.urls import unapplied_url
|
from ...models import Currency, Account
|
||||||
|
|
||||||
|
|
||||||
class CSVRow(BaseCSVRow):
|
class CSVRow(BaseCSVRow):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/17
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/17
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -23,18 +23,18 @@ from decimal import Decimal
|
|||||||
from flask import render_template, Response
|
from flask import render_template, Response
|
||||||
from flask_babel import LazyString
|
from flask_babel import LazyString
|
||||||
|
|
||||||
from accounting.locale import gettext
|
from ..utils.base_page_params import BasePageParams
|
||||||
from accounting.models import Currency, Account, JournalEntryLineItem
|
from ..utils.base_report import BaseReport
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
from ..utils.csv_export import BaseCSVRow, csv_download
|
||||||
from accounting.report.utils.base_report import BaseReport
|
from ..utils.offset_matcher import OffsetMatcher, OffsetPair
|
||||||
from accounting.report.utils.csv_export import BaseCSVRow, csv_download
|
from ..utils.option_link import OptionLink
|
||||||
from accounting.report.utils.offset_matcher import OffsetMatcher, OffsetPair
|
from ..utils.report_chooser import ReportChooser
|
||||||
from accounting.report.utils.option_link import OptionLink
|
from ..utils.report_type import ReportType
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
from ..utils.unmatched import get_accounts_with_unmatched
|
||||||
from accounting.report.utils.report_type import ReportType
|
from ..utils.urls import unmatched_url
|
||||||
from accounting.report.utils.unmatched import get_accounts_with_unmatched
|
from ...locale import gettext
|
||||||
from accounting.report.utils.urls import unmatched_url
|
from ...models import Currency, Account, JournalEntryLineItem
|
||||||
from accounting.utils.pagination import Pagination
|
from ...utils.pagination import Pagination
|
||||||
|
|
||||||
|
|
||||||
class CSVRow(BaseCSVRow):
|
class CSVRow(BaseCSVRow):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/17
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/17
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,16 +22,16 @@ from decimal import Decimal
|
|||||||
|
|
||||||
from flask import render_template, Response
|
from flask import render_template, Response
|
||||||
|
|
||||||
from accounting.locale import gettext
|
from ..utils.base_page_params import BasePageParams
|
||||||
from accounting.models import Currency, Account
|
from ..utils.base_report import BaseReport
|
||||||
from accounting.report.utils.base_page_params import BasePageParams
|
from ..utils.csv_export import BaseCSVRow, csv_download
|
||||||
from accounting.report.utils.base_report import BaseReport
|
from ..utils.option_link import OptionLink
|
||||||
from accounting.report.utils.csv_export import BaseCSVRow, csv_download
|
from ..utils.report_chooser import ReportChooser
|
||||||
from accounting.report.utils.option_link import OptionLink
|
from ..utils.report_type import ReportType
|
||||||
from accounting.report.utils.report_chooser import ReportChooser
|
from ..utils.unmatched import get_accounts_with_unmatched
|
||||||
from accounting.report.utils.report_type import ReportType
|
from ..utils.urls import unmatched_url
|
||||||
from accounting.report.utils.unmatched import get_accounts_with_unmatched
|
from ...locale import gettext
|
||||||
from accounting.report.utils.urls import unmatched_url
|
from ...models import Currency, Account
|
||||||
|
|
||||||
|
|
||||||
class CSVRow(BaseCSVRow):
|
class CSVRow(BaseCSVRow):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"""
|
"""
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from accounting.template_filters import format_amount as core_format_amount
|
from ..template_filters import format_amount as core_format_amount
|
||||||
|
|
||||||
|
|
||||||
def format_amount(value: Decimal | None) -> str | None:
|
def format_amount(value: Decimal | None) -> str | None:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/6
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/6
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -26,11 +26,11 @@ from urllib.parse import urlparse, ParseResult, parse_qsl, urlencode, \
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from accounting import db
|
|
||||||
from accounting.models import Currency, JournalEntryLineItem
|
|
||||||
from accounting.utils.journal_entry_types import JournalEntryType
|
|
||||||
from .option_link import OptionLink
|
from .option_link import OptionLink
|
||||||
from .report_chooser import ReportChooser
|
from .report_chooser import ReportChooser
|
||||||
|
from ... import db
|
||||||
|
from ...models import Currency, JournalEntryLineItem
|
||||||
|
from ...utils.journal_entry_types import JournalEntryType
|
||||||
|
|
||||||
|
|
||||||
class BasePageParams(ABC):
|
class BasePageParams(ABC):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -26,7 +26,7 @@ from urllib.parse import quote
|
|||||||
|
|
||||||
from flask import Response
|
from flask import Response
|
||||||
|
|
||||||
from accounting.report.period import Period
|
from ..period import Period
|
||||||
|
|
||||||
|
|
||||||
class BaseCSVRow(ABC):
|
class BaseCSVRow(ABC):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/8
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/8
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -23,10 +23,9 @@ import sqlalchemy as sa
|
|||||||
from flask_babel import LazyString
|
from flask_babel import LazyString
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from accounting.locale import lazy_gettext
|
from ..utils.unapplied import get_net_balances
|
||||||
from accounting.models import Currency, Account, JournalEntry, \
|
from ...locale import lazy_gettext
|
||||||
JournalEntryLineItem
|
from ...models import Currency, Account, JournalEntry, JournalEntryLineItem
|
||||||
from accounting.report.utils.unapplied import get_net_balances
|
|
||||||
|
|
||||||
|
|
||||||
class OffsetPair:
|
class OffsetPair:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/4
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/4
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -25,18 +25,18 @@ from collections.abc import Iterator
|
|||||||
|
|
||||||
from flask_babel import LazyString
|
from flask_babel import LazyString
|
||||||
|
|
||||||
from accounting import db
|
|
||||||
from accounting.locale import gettext
|
|
||||||
from accounting.models import Currency, Account
|
|
||||||
from accounting.report.period import Period, get_period
|
|
||||||
from accounting.template_globals import default_currency_code
|
|
||||||
from accounting.utils.current_account import CurrentAccount
|
|
||||||
from accounting.utils.permission import can_edit
|
|
||||||
from .option_link import OptionLink
|
from .option_link import OptionLink
|
||||||
from .report_type import ReportType
|
from .report_type import ReportType
|
||||||
from .urls import journal_url, ledger_url, income_expenses_url, \
|
from .urls import journal_url, ledger_url, income_expenses_url, \
|
||||||
trial_balance_url, income_statement_url, balance_sheet_url, \
|
trial_balance_url, income_statement_url, balance_sheet_url, \
|
||||||
unapplied_url, unmatched_url
|
unapplied_url, unmatched_url
|
||||||
|
from ..period import Period, get_period
|
||||||
|
from ... import db
|
||||||
|
from ...locale import gettext
|
||||||
|
from ...models import Currency, Account
|
||||||
|
from ...template_globals import default_currency_code
|
||||||
|
from ...utils.current_account import CurrentAccount
|
||||||
|
from ...utils.permission import can_edit
|
||||||
|
|
||||||
|
|
||||||
class ReportChooser:
|
class ReportChooser:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/7
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/7
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -21,10 +21,9 @@ from decimal import Decimal
|
|||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from accounting import db
|
from ... import db
|
||||||
from accounting.models import Currency, Account, JournalEntry, \
|
from ...models import Currency, Account, JournalEntry, JournalEntryLineItem
|
||||||
JournalEntryLineItem
|
from ...utils.offset_alias import offset_alias
|
||||||
from accounting.utils.offset_alias import offset_alias
|
|
||||||
|
|
||||||
|
|
||||||
def get_accounts_with_unapplied(currency: Currency) -> list[Account]:
|
def get_accounts_with_unapplied(currency: Currency) -> list[Account]:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/8
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/8
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -19,9 +19,8 @@
|
|||||||
"""
|
"""
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from accounting import db
|
from ... import db
|
||||||
from accounting.models import Currency, Account, JournalEntry, \
|
from ...models import Currency, Account, JournalEntry, JournalEntryLineItem
|
||||||
JournalEntryLineItem
|
|
||||||
|
|
||||||
|
|
||||||
def get_accounts_with_unmatched(currency: Currency) -> list[Account]:
|
def get_accounts_with_unmatched(currency: Currency) -> list[Account]:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/9
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/9
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -19,11 +19,11 @@
|
|||||||
"""
|
"""
|
||||||
from flask import url_for
|
from flask import url_for
|
||||||
|
|
||||||
from accounting.models import Currency, Account
|
from ...models import Currency, Account
|
||||||
from accounting.report.period import Period
|
from ...report.period import Period
|
||||||
from accounting.template_globals import default_currency_code
|
from ...template_globals import default_currency_code
|
||||||
from accounting.utils.current_account import CurrentAccount
|
from ...utils.current_account import CurrentAccount
|
||||||
from accounting.utils.options import options
|
from ...utils.options import options
|
||||||
|
|
||||||
|
|
||||||
def journal_url(period: Period) \
|
def journal_url(period: Period) \
|
||||||
|
|||||||
@@ -19,15 +19,6 @@
|
|||||||
"""
|
"""
|
||||||
from flask import Blueprint, request, Response, redirect, flash
|
from flask import Blueprint, request, Response, redirect, flash
|
||||||
|
|
||||||
from accounting import db
|
|
||||||
from accounting.locale import lazy_gettext
|
|
||||||
from accounting.models import Currency, Account
|
|
||||||
from accounting.template_globals import default_currency_code
|
|
||||||
from accounting.utils.cast import s
|
|
||||||
from accounting.utils.current_account import CurrentAccount
|
|
||||||
from accounting.utils.next_uri import or_next
|
|
||||||
from accounting.utils.options import options
|
|
||||||
from accounting.utils.permission import has_permission, can_view, can_edit
|
|
||||||
from .period import Period, get_period
|
from .period import Period, get_period
|
||||||
from .reports import Journal, Ledger, IncomeExpenses, TrialBalance, \
|
from .reports import Journal, Ledger, IncomeExpenses, TrialBalance, \
|
||||||
IncomeStatement, BalanceSheet, Search
|
IncomeStatement, BalanceSheet, Search
|
||||||
@@ -38,6 +29,15 @@ from .reports.unmatched_accounts import AccountsWithUnmatchedOffsets
|
|||||||
from .template_filters import format_amount
|
from .template_filters import format_amount
|
||||||
from .utils.offset_matcher import OffsetMatcher
|
from .utils.offset_matcher import OffsetMatcher
|
||||||
from .utils.urls import unmatched_url
|
from .utils.urls import unmatched_url
|
||||||
|
from .. import db
|
||||||
|
from ..locale import lazy_gettext
|
||||||
|
from ..models import Currency, Account
|
||||||
|
from ..template_globals import default_currency_code
|
||||||
|
from ..utils.cast import s
|
||||||
|
from ..utils.current_account import CurrentAccount
|
||||||
|
from ..utils.next_uri import or_next
|
||||||
|
from ..utils.options import options
|
||||||
|
from ..utils.permission import has_permission, can_view, can_edit
|
||||||
|
|
||||||
bp: Blueprint = Blueprint("accounting-report", __name__)
|
bp: Blueprint = Blueprint("accounting-report", __name__)
|
||||||
"""The view blueprint for the reports."""
|
"""The view blueprint for the reports."""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/25
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/25
|
||||||
|
|
||||||
# Copyright (c) 2023-2024 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -23,8 +23,8 @@ from typing import Any
|
|||||||
|
|
||||||
from flask_babel import get_locale
|
from flask_babel import get_locale
|
||||||
|
|
||||||
from accounting.locale import gettext
|
from .locale import gettext
|
||||||
from accounting.utils.timezone import get_tz_today
|
from .utils.timezone import get_tz_today
|
||||||
|
|
||||||
|
|
||||||
def format_amount(value: Decimal | None) -> str | None:
|
def format_amount(value: Decimal | None) -> str | None:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/3
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/3
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
"""The template globals.
|
"""The template globals.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from accounting.models import Currency
|
from .models import Currency
|
||||||
from accounting.utils.options import options
|
from .utils.options import options
|
||||||
|
|
||||||
|
|
||||||
def currency_options() -> list[Currency]:
|
def currency_options() -> list[Currency]:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/22
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/22
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -21,8 +21,8 @@ from typing import Self
|
|||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from accounting.locale import gettext
|
from ..locale import gettext
|
||||||
from accounting.models import Account
|
from ..models import Account
|
||||||
|
|
||||||
|
|
||||||
class CurrentAccount:
|
class CurrentAccount:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/15
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/15
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -21,7 +21,7 @@ from typing import Any
|
|||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from accounting.models import JournalEntryLineItem
|
from ..models import JournalEntryLineItem
|
||||||
|
|
||||||
|
|
||||||
def offset_alias() -> sa.Alias:
|
def offset_alias() -> sa.Alias:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/22
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/22
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -21,10 +21,10 @@ import json
|
|||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from accounting import db
|
from .current_account import CurrentAccount
|
||||||
from accounting.models import Option, Account, Currency
|
from .user import get_current_user_pk
|
||||||
from accounting.utils.current_account import CurrentAccount
|
from .. import db
|
||||||
from accounting.utils.user import get_current_user_pk
|
from ..models import Option, Account, Currency
|
||||||
|
|
||||||
|
|
||||||
class RecurringItem:
|
class RecurringItem:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
|
||||||
|
|
||||||
# Copyright (c) 2023-2024 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -25,7 +25,7 @@ from urllib.parse import urlparse, parse_qsl, urlencode, urlunparse, \
|
|||||||
from flask import request
|
from flask import request
|
||||||
from werkzeug.routing import RequestRedirect
|
from werkzeug.routing import RequestRedirect
|
||||||
|
|
||||||
from accounting.locale import pgettext
|
from ..locale import pgettext
|
||||||
|
|
||||||
|
|
||||||
class Link:
|
class Link:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -23,7 +23,7 @@ from collections.abc import Callable
|
|||||||
|
|
||||||
from flask import abort, Blueprint, Response
|
from flask import abort, Blueprint, Response
|
||||||
|
|
||||||
from accounting.utils.user import get_current_user, UserUtilityInterface
|
from .user import get_current_user, UserUtilityInterface
|
||||||
|
|
||||||
|
|
||||||
def has_permission(rule: Callable[[], bool]) -> Callable:
|
def has_permission(rule: Callable[[], bool]) -> Callable:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -21,8 +21,6 @@ This module should not import any other module from the application.
|
|||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from typing_extensions import assert_type
|
|
||||||
|
|
||||||
|
|
||||||
def parse_query_keywords(q: str | None) -> list[str]:
|
def parse_query_keywords(q: str | None) -> list[str]:
|
||||||
"""Returns the query keywords by the query parameter.
|
"""Returns the query keywords by the query parameter.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/30
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/30
|
||||||
|
|
||||||
# Copyright (c) 2023 imacat.
|
# Copyright (c) 2023-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -22,7 +22,7 @@ This module should not import any other module from the application.
|
|||||||
from secrets import randbelow
|
from secrets import randbelow
|
||||||
from typing import Type
|
from typing import Type
|
||||||
|
|
||||||
from accounting import db
|
from .. import db
|
||||||
|
|
||||||
|
|
||||||
def new_id(cls: Type[db.Model]):
|
def new_id(cls: Type[db.Model]):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# The Mia! Accounting Project.
|
# The Mia! Accounting Project.
|
||||||
# Author: imacat@mail.imacat.idv.tw (imacat), 2024/6/4
|
# Author: imacat@mail.imacat.idv.tw (imacat), 2024/6/4
|
||||||
|
|
||||||
# Copyright (c) 2024 imacat.
|
# Copyright (c) 2024-2026 imacat.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
This module should not import any other module from the application.
|
This module should not import any other module from the application.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
|
|||||||
Reference in New Issue
Block a user