auxi.modelling.financial.des module

This module provides classes representing the accounting double entry system.

auxi.modelling.financial.des.AT

alias of AccountType

class auxi.modelling.financial.des.AccountType

Bases: enum.Enum

Represents the type of general ledger account.

asset = 1
equity = 2
expense = 3
liability = 4
revenue = 5
class auxi.modelling.financial.des.GeneralLedger(name, structure, description=None)

Bases: auxi.core.objects.NamedObject

Represents the account structure of a general ledger.

Parameters:
  • name – The name.
  • structure – The general ledger structure.
  • description – The description.
balance_sheet(end=datetime.datetime(9999, 12, 31, 23, 59, 59, 999999), format=<ReportFormat.printout: (1, )>, output_path=None)

Generate a transaction list report.

Parameters:
  • end – The end date to generate the report for.
  • format – The format of the report.
  • output_path – The path to the file the report is written to. If None, then the report is not written to a file.
Returns:

The generated report.

create_transaction(name, description=None, tx_date=datetime.date(1, 1, 1), dt_account=None, cr_account=None, source=None, amount=0.0)

Create a transaction in the general ledger.

Parameters:
  • name – The transaction’s name.
  • description – The transaction’s description.
  • tx_date – The date of the transaction.
  • cr_account – The transaction’s credit account’s name.
  • dt_account – The transaction’s debit account’s name.
  • source – The name of source the transaction originated from.
  • amount – The transaction amount.
Returns:

The created transaction.

income_statement(start=datetime.datetime(1, 1, 1, 0, 0), end=datetime.datetime(9999, 12, 31, 23, 59, 59, 999999), format=<ReportFormat.printout: (1, )>, component_path='', output_path=None)

Generate a transaction list report.

Parameters:
  • start – The start date to generate the report for.
  • end – The end date to generate the report for.
  • format – The format of the report.
  • component_path – The path of the component to filter the report’s transactions by.
  • output_path – The path to the file the report is written to. If None, then the report is not written to a file.
Returns:

The generated report.

transaction_list(start=datetime.datetime(1, 1, 1, 0, 0), end=datetime.datetime(9999, 12, 31, 23, 59, 59, 999999), format=<ReportFormat.printout: (1, )>, component_path='', output_path=None)

Generate a transaction list report.

Parameters:
  • start – The start date to generate the report for.
  • end – The end date to generate the report for.
  • format – The format of the report.
  • component_path – The path of the component to filter the report’s transactions by.
  • output_path – The path to the file the report is written to. If None, then the report is not written to a file.
Returns:

The generated report.

class auxi.modelling.financial.des.GeneralLedgerAccount(name, description=None, number=None, account_type=<AccountType.revenue: 5>)

Bases: auxi.core.objects.NamedObject

Represents an account of a general ledger.

Parameters:
  • name – The name.
  • description – The description.
  • number – The number.
  • account_type – The type of account.
create_account(name, number=None, description=None)

Create a sub account in the account.

Parameters:
  • name – The account name.
  • description – The account description.
  • number – The account number.
Returns:

The created account.

get_child_account(account_name)

Retrieves a child account. This could be a descendant nested at any level.

Parameters:account_name – The name of the account to retrieve.
Returns:The child account, if found, else None.
name
remove_account(name)

Remove an account from the account’s sub accounts.

Parameters:name – The name of the account to remove.
set_parent_path(value)

Set the parent path and the path from the new parent path.

Parameters:value – The path to the object’s parent
class auxi.modelling.financial.des.GeneralLedgerStructure(name, description=None)

Bases: auxi.core.objects.NamedObject

The account structure of a general ledger.

Parameters:
  • name – The name.
  • description – The description.
get_account(account_name)

Retrieves an account from the general ledger structure given the account name.

Parameters:account_name – The account name.
Returns:The requested account, if found, else None.
get_account_descendants(account)

Retrieves an account’s descendants from the general ledger structure given the account name.

Parameters:account_name – The account name.
Returns:The decendants of the account.
report(format=<ReportFormat.printout: (1, )>, output_path=None)

Returns a report of this class.

Parameters:
  • format – The format of the report.
  • output_path – The path to the file the report is written to. If None, then the report is not written to a file.
Returns:

The descendants of the account.

validate_account_names(names)

Validates whether the accounts in a list of account names exists.

Parameters:names – The names of the accounts.
Returns:The descendants of the account.
class auxi.modelling.financial.des.Transaction(name, description=None, tx_date=datetime.date(1, 1, 1), dt_account=None, cr_account=None, source=None, amount=0.0, is_closing_dt_account=False, is_closing_cr_account=False)

Bases: auxi.core.objects.NamedObject

Represents a financial transaction between two general ledger accounts.

Parameters:
  • name – The name.
  • description – The description.
  • tx_date – The transaction’s date.
  • dt_account – The account to debit.
  • cr_account – The account to credit.
  • source – The source that created the transaction.
  • amount – The transaction’s amount.
  • is_closing_dt_account – Specifies whether this is a closing debit account.
  • is_closing_cr_account – Specifies whether this is a closing credit account.
class auxi.modelling.financial.des.TransactionTemplate(name, dt_account, cr_account, description=None)

Bases: auxi.core.objects.NamedObject

Represents a template for how a transaction is to be created.

Parameters:
  • name – The name of the transaction.
  • description – The description of the transaction.
  • dt_account – The account to debit.
  • cr_account – The account to credit.