exceptions

Provides exceptions arising from accounting operations.

Package Contents

exception exceptions.AccountingExeption

Bases: Exception

Base accounting exception

msg

Human readable string describing the exception.

Type:

str

message: str
__str__() str

Return str(self).

exception exceptions.AdjustingReportingPeriodError(reporting_period)

Bases: AccountingExeption

Only Journal Entry Transactions can be recorded for adjusting status Reporting Periods.

Parameters:

reporting_period (ReportingPeriod) – The Reporting Period in question.

exception exceptions.ClosedReportingPeriodError(reporting_period)

Bases: AccountingExeption

Transactions cannot be recorded for closed reporting periods.

Parameters:

reporting_period (ReportingPeriod) – The Reporting Period in question.

exception exceptions.DuplicateReportingPeriodError

Bases: AccountingExeption

An Entity can only have one reporting period per calendar year.

exception exceptions.InvalidAccountTypeError(message: str)

Bases: AccountingExeption

The account type must be one of those given in the list.

Parameters:

message (str) – A string containing the list of allowed Account Types.

exception exceptions.HangingTransactionsError(model)

Bases: AccountingExeption

The account cannot be deleted because it has Transactions in the current reporting period.

Parameters:

model (DeclarativeBase) – The model to be deleted.

exception exceptions.InvalidBalanceAccountError

Bases: AccountingExeption

Income Statement Accounts cannot have an opening balance.

exception exceptions.InvalidBalanceDateError

Bases: AccountingExeption

Unless the Entity allows for mid year balances, the balance date must be earlier than its reporting period’s start.

exception exceptions.InvalidBalanceTransactionError

Bases: AccountingExeption

Balance Transaction must be one of Client Invoice, Supplier Bill or Journal Entry.

exception exceptions.InvalidCategoryAccountTypeError(account_type, category_account_type)

Bases: AccountingExeption

The account type must the same as the category account type.

Parameters:
  • account_type (Account.AccountType) – The account type of the Account.

  • category_account_type (Account.AccountType) – The account type of the Category.

exception exceptions.InvalidLineItemAccountError(classname, account_types: list)

Bases: AccountingExeption

The Line Item main Account type must be one of those given in the list.

Parameters:
  • classname (Transaction.TransactionType) – The type of the Transaction.

  • account_types (list) – The list of allowed Account types for the Transaction.

exception exceptions.InvalidMainAccountError(classname, account_type: str)

Bases: AccountingExeption

The account type of the transaction must be of the type given.

Parameters:
  • classname (Transaction.TransactionType) – The type of the Transaction.

  • account_type (str) – The allowed Account type for the Transaction.

exception exceptions.InvalidTaxAccountError

Bases: AccountingExeption

A Tax account must be of type Control.

exception exceptions.InvalidTaxChargeError(classname)

Bases: AccountingExeption

A Contra Entry Transaction cannot be charged Tax.

Parameters:

classname (Transaction.TransactionType) – The type of the Transaction.

exception exceptions.InvalidTransactionDateError

Bases: AccountingExeption

The Transaction date cannot be the exact beginning of the reporting period.

exception exceptions.InvalidTransactionTypeError

Bases: AccountingExeption

The Transaction type cannot be changed as this would bypass subclass validations.

exception exceptions.MissingEntityError

Bases: AccountingExeption

Accounting objects must all be associated with an Entity.

exception exceptions.MissingLineItemError

Bases: AccountingExeption

A Transaction must have at least one Line Item to be posted.

exception exceptions.MissingMainAccountAmountError

Bases: AccountingExeption

A Compound Journal Entry Transaction must have a main account amount.

exception exceptions.MissingReportingPeriodError(entity, year)

Bases: AccountingExeption

The Entity does not have a reporting period for the given date.

exception exceptions.MissingTaxAccountError

Bases: AccountingExeption

A non Zero Rate Tax must have an associated control account.

exception exceptions.MultipleOpenPeriodsError

Bases: AccountingExeption

An Entity can only have one reporting period open at a time.

exception exceptions.NegativeValueError(classname, attribute='amount')

Bases: AccountingExeption

Accounting amounts should not be negative.

Parameters:
  • classname (DeclarativeBase) – The model in question.

  • attribute – The model attribute that must be greater than zero.

exception exceptions.PostedTransactionError(message)

Bases: AccountingExeption

Changes are not allowed for a posted Transaction.

Parameters:

message (str) – The changes that are not allowed for a posted Transaction.

exception exceptions.RedundantTransactionError(line_item)

Bases: AccountingExeption

A Transaction main account cannot be used as the account for any of its Line Items.

Parameters:

line_item (LineItem) – The line item in question.

exception exceptions.SessionEntityError

Bases: AccountingExeption

The Session Entity should not be deleted.

exception exceptions.UnbalancedTransactionError

Bases: AccountingExeption

Total Debit amounts do not match total Credit amounts.

exception exceptions.UnassignableTransactionError(classname, transaction_types: list)

Bases: AccountingExeption

The Transaction type must be one of those given in the list.

Parameters:

line_item (LineItem) – The line item in question.

exception exceptions.UnclearableTransactionError(classname, transaction_types: list)

Bases: AccountingExeption

The Transaction type must be one of those given in the list.

Parameters:
  • classname (Transaction.TransactionType) – The type of the Transaction.

  • transaction_types (list) – The list of allowed Transactiom types for the Assignment.

exception exceptions.UnpostedAssignmentError

Bases: AccountingExeption

An unposted Transaction cannot be cleared or assigned.

exception exceptions.SelfClearanceError

Bases: AccountingExeption

A Transaction cannot clear/be assigned to itself.

exception exceptions.InvalidAssignmentAccountError

Bases: AccountingExeption

The main account for the cleared and clearing Transaction must be the same.

exception exceptions.InvalidClearanceEntryTypeError(entry_type: str)

Bases: AccountingExeption

Transaction Entry increases the Main Account outstanding balance instead of reducing it.

Parameters:

entry_type (Balance.BalanceType) – The type of the Transaction entry.

exception exceptions.CompoundTransactionAssignmentError

Bases: AccountingExeption

A compound Transaction cannot be cleared or assigned.

exception exceptions.InsufficientBalanceError(assigning: str, amount: float, assigned: str)

Bases: AccountingExeption

Assigning Transaction does not have suffecient balance to clear the amount specified of the assigned.

Parameters:
  • assigning (str) – The type of the Transaction to be assigned.

  • amount (Decimal) – The amount to be assigned.

  • assigned (str) – The type of the Transaction to be cleared.

exception exceptions.OverclearanceError(assigned: str)

Bases: AccountingExeption

The assigned Transaction has already been completely cleared.

Parameters:

assigned (str) – The type of the Transaction to be cleared.

exception exceptions.MixedAssignmentError(previous: str, current: str)

Bases: AccountingExeption

An assigned/cleared cannot be cleared/assigned.

Parameters:
  • previous (str) – The role played by the Transaction in a previous Assignment.

  • current (str) – The role played by the Transaction in the current Assignment.