A Flask accounting module.
Project description
Description
Mia! Accounting is an accounting module for Flask applications. It is designed both for mobile and desktop environments. It implements double-entry bookkeeping. It generates the following accounting reports:
Trial balance
Income statement
Balance sheet
In addition, Mia! Accounting tracks offsets for unpaid payables and receivables.
Live Demonstration and Test Site
There is a live demonstration for Mia! Accounting. It runs the same code as the test site in the source distribution. It is the simplest website that works with Mia! Accounting. It is also used in the automatic tests.
If you do not have a running Flask application or do not know how to start one, you may start with the test site.
Installation
Install Mia! Accounting with pip:
pip install mia-accounting
You may also download from the PyPI project page or the release page on the Git repository.
Prerequisites
You need a running Flask application with database user login. The primary key of the user data model must be integer. You also need at least one user.
The following front-end JavaScript libraries must be loaded. You may download it locally or use CDN.
Bootstrap 5.2.3 or above
FontAwesome 6.2.1 or above
Decimal.js 6.4.3 or above
Tempus-Dominus 6.4.3 or above
Configuration
You need to pass the Flask app and an implementation of UserUtilityInterface to the init_app function. UserUtilityInterface contains everything Mia! Accounting needs.
The following is an example configuration for Mia! Accounting.
from flask import Response, redirect from .auth import current_user() from .modules import User def create_app(test_config=None) -> Flask: app: Flask = Flask(__name__) ... (Configuration of SQLAlchemy, CSRF, Babel_JS, ... etc) ... import accounting class UserUtils(accounting.UserUtilityInterface[User]): def can_view(self) -> bool: return True def can_edit(self) -> bool: return "editor" in current_user().roles def can_admin(self) -> bool: return current_user().is_admin def unauthorized(self) -> Response: return redirect("/login") @property def cls(self) -> t.Type[User]: return User @property def pk_column(self) -> Column: return User.id @property def current_user(self) -> User | None: return current_user() def get_by_username(self, username: str) -> User | None: return User.query.filter(User.username == username).first() def get_pk(self, user: User) -> int: return user.id accounting.init_app(app, UserUtils()) ... (Any other configuration) ... return app
Database Initialization
After the configuration, run the accounting-init-db console command to initialize the accounting database. You need to specify the username of a user as the data creator.
% flask --app myapp accounting-init-db -u username
Documentation
Refer to the documentation on Read the Docs.
Copyright
Copyright (c) 2023 imacat.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mia_accounting-1.3.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e92013779a14ce16211c9b14d249b7d329917834fa7a3a43fd7b9bbcaaeefc1 |
|
MD5 | 91e0d67e759fcf819d0371ad4169df01 |
|
BLAKE2b-256 | 427c2b9bd0dc8131a33dd8f72fb4f0e741da9151a9415945f174dfd6f596774a |