accounting.account package

Submodules

accounting.account.commands module

The console commands for the account management.

accounting.account.commands.AccountData

The format of the account data, as a list of (ID, base account code, number, English, Traditional Chinese, Simplified Chinese, is-need-offset) tuples.

alias of tuple[int, str, int, str, str, str, bool]

accounting.account.commands.init_accounts_command(username: str) None

Initializes the accounts.

accounting.account.converters module

The path converters for the account management.

class accounting.account.converters.AccountConverter(map: Map, *args: t.Any, **kwargs: t.Any)

Bases: BaseConverter

The account converter to convert the account code and to the corresponding account in the routes.

to_python(value: str) Account

Converts an account code to an account.

Parameters:

value – The account code.

Returns:

The corresponding account.

to_url(value: Account) str

Converts an account to its code.

Parameters:

value – The account.

Returns:

The code.

accounting.account.forms module

The forms for the account management.

class accounting.account.forms.AccountForm(*args, **kwargs)

Bases: FlaskForm

The form to create or edit an account.

base_code = <UnboundField(StringField, (), {'filters': [<function strip_text>], 'validators': [<wtforms.validators.DataRequired object>, <accounting.account.forms.BaseAccountExists object>, <accounting.account.forms.BaseAccountAvailable object>]})>

The code of the base account.

property base_options: list[BaseAccount]

The selectable base accounts.

Returns:

The selectable base accounts.

is_need_offset = <UnboundField(BooleanField, (), {'validators': [<accounting.account.forms.NoOffsetNominalAccount object>]})>

Whether the the journal entry line items of this account need offset.

populate_obj(obj: Account) None

Populates the form data into an account object.

Parameters:

obj – The account object.

Returns:

None.

post_update(obj: Account) None

The post-processing after the update.

Parameters:

obj – The account object.

Returns:

None

property selected_base: BaseAccount | None

The selected base account in the form.

Returns:

The selected base account in the form.

title = <UnboundField(StringField, (), {'filters': [<function strip_text>], 'validators': [<wtforms.validators.DataRequired object>]})>

The title.

class accounting.account.forms.AccountReorderForm(base: BaseAccount)

Bases: object

The form to reorder the accounts.

base: BaseAccount

The base account.

is_modified: bool

Whether the order is modified.

save_order() None

Saves the order of the account.

Returns:

class accounting.account.forms.BaseAccountAvailable

Bases: object

The validator to check if the base account is available.

class accounting.account.forms.BaseAccountExists

Bases: object

The validator to check if the base account exists.

class accounting.account.forms.NoOffsetNominalAccount

Bases: object

The validator to check nominal account is not to be offset.

accounting.account.forms.sort_accounts_in(base_code: str, exclude: int) None

Sorts the accounts under a base account after changing the base account or deleting an account.

Parameters:
  • base_code – The code of the base account.

  • exclude – The account ID to exclude.

Returns:

None.

accounting.account.queries module

The queries for the account management.

accounting.account.queries.get_account_query() list[Account]

Returns the accounts, optionally filtered by the query.

Returns:

The accounts.

accounting.account.views module

The views for the account management.

accounting.account.views.bp: Blueprint = <Blueprint 'account'>

The view blueprint for the account management.

Module contents

The account management.

accounting.account.init_app(app: Flask, bp: Blueprint) None

Initialize the application.

Parameters:
  • app – The Flask application.

  • bp – The blueprint of the accounting application.

Returns:

None.