-
Notifications
You must be signed in to change notification settings - Fork 2
Entry
Documentation > Entry
Entries compose Transactions. An individual entry allocates some value to an Account as either one of the fundamental Sides: a debit or a credit. All together, those debits and credits will add up to zero, satisfying the fundamental double-entry accounting equality.
When consuming the Amatino API, operations involving Entries always occur as part of a Transaction request. For example, when creating a Transaction, you will specify a list of Entry objects under the entries key. You will never send or recieve an Entry object on its own to or from the Amatino API.
Unlike almost all other classes in Amatino Python, Entries are initialised using the native __init__ initialiser rather than through a class method.
.side - Side
Either a debit or a credit.
Example: Side.debit
The integer identifier of the Account to which this Entry records value.
Example: 42
A Decimal absolute magnitude of the value of this Entry
Example: 125.23
A string human-readable description of this Entry
Example: 'Record deposit component of customer order'
Unlike most other Amatino Python classes, Entries require the use of their native init initialiser.
debit = Entry(
side=Side.debit,
amount=Decimal(42),
account=cash_account
)Return a list containing pair of Entries. The two Entries will be in balance. Useful as a shorthand when creating a Transaction to which only two Accounts are party.
balanced_pair = Entry.create_balanced_pair(
debit_account=cash_account,
credit_account=revenue,
amount=Decimal(42)
)Return an Entry that plugs the balance gap in a set of given Entries. Or, return None if the Entries are already in balance. Handy as a shorthand when you know that the final Entry in a Transaction is the remaining imbalance from already calculated Entries.
- account: Account
- entries: List[Entry]
- description: Optional[str]
entry_1 = Entry(Side.debit, Decimal(5), cash_account)
entry_2 = Entry(Side.credit, Decimal(10), revenue_account)
plug_entry = Entry.plug(
account=receivables,
entries=[entry_1, entry_2]
)
print(plug_entry.amount)
# Prints '5'