kescher package¶
Submodules¶
kescher.booking module¶
-
kescher.booking.
auto_book_vat
(percentage, vat_in_acc, vat_out_acc)¶ This function automatically books VAT for all journal entries.
TODO: Filtering by date/range and check for existing bookings to prevent double booking.
-
kescher.booking.
book_entry
(value, comment, journalentry_id, account_name, force)¶ Book a journalentry to some account.
-
kescher.booking.
get_account_saldo
(account, start_date=None, end_date=None, with_virtual=False)¶ Sums all bookings for the given account in the given timeframe to return 1 decimal (or two, if also the virtual bookings shall be considered).
If the selected account is parent to other accounts, the total of all child accounts will be returned.
kescher.cli module¶
kescher.importers module¶
Home of all importers.
Importers are bulk operators. I.e. they read yaml or csv data and put them into the database in bulks. This is necessary to get bank data, as well as the account structure easily into the database, without having to set up everything by hand or one by one.
-
class
kescher.importers.
AccountImporter
(account_file)¶ Bases:
kescher.importers.Importer
The AccountImporter is a helper to set up your accounts (Kontenrahmen). As this can easily done in a yaml file. This yaml file is then loaded into the AccountImporter which will automagically create all accounts accordingly.
-
import_accounts
()¶ This wrapper function is to to be called from external functions or __call__(). After importing the accounts it deletes the class instance and closes the db connection, to ensure the db connection is not left open, and then not run again.
-
-
class
kescher.importers.
DocumentImporter
(path, flat=True)¶ Bases:
kescher.importers.Importer
The DocumentImporter assists for bulk importing documents.
-
EXTENSION
= '.pdf'¶
-
import_documents
()¶
-
-
class
kescher.importers.
Importer
¶ Bases:
object
Importer base class creates the logger instance and the import_date.
-
class
kescher.importers.
InvoiceImporter
(path, account_key, amount_key, date_key, flat=False)¶ Bases:
kescher.importers.Importer
-
EXTENSION
= '.yaml'¶
-
import_invoices
()¶
-
-
class
kescher.importers.
JournalImporter
(csv_file, delimiter=';', quotechar='"')¶ Bases:
kescher.importers.Importer
-
import_rows
()¶ This functions reads all rows and creates temp objects in a list, after all lines were read sucessfully, the objects are saved.
-
kescher.logging module¶
-
kescher.logging.
setup_logging
(cwd)¶ Creates and returnes a logger with the default logging level “INFO” in the current working directory.
kescher.models module¶
-
class
kescher.models.
Account
(*args, **kwargs)¶ Bases:
kescher.models.BaseModel
Accounts are used to structure bookings e.g. by type, customer, etc.
-
DoesNotExist
¶ alias of
AccountDoesNotExist
-
account_entries
¶
-
child_accounts
¶
-
id
= <AutoField: Account.id>¶
-
name
= <CharField: Account.name>¶
-
parent
= <ForeignKeyField: Account.parent>¶
-
parent_id
= <ForeignKeyField: Account.parent>¶
-
updated_at
= <DateTimeField: Account.updated_at>¶
-
-
class
kescher.models.
BaseModel
(*args, **kwargs)¶ Bases:
peewee.Model
-
DoesNotExist
¶ alias of
BaseModelDoesNotExist
-
id
= <AutoField: BaseModel.id>¶
-
save
(*args, **kwargs)¶
-
updated_at
= <DateTimeField: BaseModel.updated_at>¶
-
-
class
kescher.models.
Booking
(*args, **kwargs)¶ Bases:
kescher.models.BaseModel
A booking references a (partial) amount of a JournalEntry to an Account.
-
DoesNotExist
¶ alias of
BookingDoesNotExist
-
account
= <ForeignKeyField: Booking.account>¶
-
account_id
= <ForeignKeyField: Booking.account>¶
-
comment
= <CharField: Booking.comment>¶
-
id
= <AutoField: Booking.id>¶
-
journalentry
= <ForeignKeyField: Booking.journalentry>¶
-
journalentry_id
= <ForeignKeyField: Booking.journalentry>¶
-
updated_at
= <DateTimeField: Booking.updated_at>¶
-
value
= <DecimalField: Booking.value>¶
-
-
class
kescher.models.
Document
(*args, **kwargs)¶ Bases:
kescher.models.BaseModel
A Document is an invoice/receipt which reasons a JournalEntry.
-
DoesNotExist
¶ alias of
DocumentDoesNotExist
-
content
= <TextField: Document.content>¶
-
hash
= <CharField: Document.hash>¶
-
id
= <AutoField: Document.id>¶
-
journal_entries
¶
-
static
make_hash
(path)¶
-
path
= <CharField: Document.path>¶
-
updated_at
= <DateTimeField: Document.updated_at>¶
-
-
class
kescher.models.
JournalEntry
(*args, **kwargs)¶ Bases:
kescher.models.BaseModel
A JournalEntry is one row (line) in your imported journal (bank statement).
-
DoesNotExist
¶ alias of
JournalEntryDoesNotExist
-
account_entries
¶
-
balance
= <DecimalField: JournalEntry.balance>¶
-
date
= <DateField: JournalEntry.date>¶
-
document
= <ForeignKeyField: JournalEntry.document>¶
-
document_id
= <ForeignKeyField: JournalEntry.document>¶
-
id
= <AutoField: JournalEntry.id>¶
-
imported_at
= <DateTimeField: JournalEntry.imported_at>¶
-
receiver
= <CharField: JournalEntry.receiver>¶
-
sender
= <CharField: JournalEntry.sender>¶
-
subject
= <CharField: JournalEntry.subject>¶
-
updated_at
= <DateTimeField: JournalEntry.updated_at>¶
-
value
= <DecimalField: JournalEntry.value>¶
-
-
class
kescher.models.
PathField
(null=False, index=False, unique=False, column_name=None, default=None, primary_key=False, constraints=None, sequence=None, collation=None, unindexed=False, choices=None, help_text=None, verbose_name=None, index_type=None, db_column=None, _hidden=False)¶ Bases:
peewee.Field
-
db_value
(value)¶
-
field_type
= 'TEXT'¶
-
python_value
(value)¶
-
-
class
kescher.models.
VirtualBooking
(*args, **kwargs)¶ Bases:
kescher.models.BaseModel
To allow for cash accounting, all invoices are to be created as virtual account entries.
-
DoesNotExist
¶ alias of
VirtualBookingDoesNotExist
-
account
= <ForeignKeyField: VirtualBooking.account>¶
-
account_id
= <ForeignKeyField: VirtualBooking.account>¶
-
comment
= <CharField: VirtualBooking.comment>¶
-
date
= <DateField: VirtualBooking.date>¶
-
document
= <ForeignKeyField: VirtualBooking.document>¶
-
document_id
= <ForeignKeyField: VirtualBooking.document>¶
-
id
= <AutoField: VirtualBooking.id>¶
-
updated_at
= <DateTimeField: VirtualBooking.updated_at>¶
-
value
= <DecimalField: VirtualBooking.value>¶
-
-
kescher.models.
create_tables
()¶
kescher.sanitizers module¶
This script sanitizes CSV files downloaded from Postbank (Germany). It strips useless characters, and converts the numbers to a reasonable and usable format.
-
exception
kescher.sanitizers.
CsvHeaderError
¶ Bases:
Exception