models.ledger
Represents an entry in the Ledger.
Module Contents
Classes
Represents an entry in the Ledger. (Should never have to be invoked directly). |
- class models.ledger.Ledger
Bases:
python_accounting.mixins.IsolatingMixin,python_accounting.models.RecyclableRepresents an entry in the Ledger. (Should never have to be invoked directly).
- __mapper_args__
- id: sqlalchemy.orm.Mapped[int]
The primary key of the ledger database record.
- Type:
(int)
- transaction_date: sqlalchemy.orm.Mapped[datetime.datetime]
The date of the Transaction associated with the Ledger.
- Type:
(datetime)
- entry_type: sqlalchemy.orm.Mapped[strenum.StrEnum]
The side of the double entry to which the Ledger is posted.
- Type:
(BalanceType)
- amount: sqlalchemy.orm.Mapped[decimal.Decimal]
The amount posted to the Ledger by the entry.
- Type:
(Decimal)
- hash: sqlalchemy.orm.Mapped[str]
The encoded contents of the Ledger entry.
- Type:
(str)
- transaction_id: sqlalchemy.orm.Mapped[int]
The id of the Transaction associated with the Ledger.
- Type:
(int)
- currency_id: sqlalchemy.orm.Mapped[int]
The id of the Currency associated with the Ledger.
- Type:
(int)
- post_account_id: sqlalchemy.orm.Mapped[int]
The id of the Account to which the Ledger is posted.
- Type:
(int)
- folio_account_id: sqlalchemy.orm.Mapped[int]
The id of the Account to which the opposite side of Ledger is posted.
- Type:
(int)
- line_item_id: sqlalchemy.orm.Mapped[int]
The id of the Line Item associated with the Ledger.
- Type:
(int, optional)
- tax_id: sqlalchemy.orm.Mapped[int]
The id of the Tax associated with the Ledger.
- Type:
(int, optional)
- transaction: sqlalchemy.orm.Mapped[python_accounting.models.Transaction]
The Transaction associated with the Ledger.
- Type:
- currency: sqlalchemy.orm.Mapped[Currency]
The Currency associated with the Ledger.
- Type:
(Currency)
- post_account: sqlalchemy.orm.Mapped[Account]
The main Account associated with the Ledger.
- Type:
(Account)
- folio_account: sqlalchemy.orm.Mapped[Account]
The oppeite double entry Account associated with the Ledger.
- Type:
(Account)
- line_item: sqlalchemy.orm.Mapped[LineItem]
The LineItem associated with the Ledger.
- Type:
(LineItem)
- __repr__() str
- static _allocate_amount(session, post, amount, posts, folios, transaction, entry_type) None
- static _make_compound_ledgers(session, posts: list, folios: list, transaction: python_accounting.models.Transaction, entry_type: python_accounting.models.Balance.BalanceType) None
- static _post_compound(session, transaction: python_accounting.models.Transaction) None
- static _transaction_ledgers(transaction: python_accounting.models.Transaction) tuple
- static _post_simple(session, transaction: python_accounting.models.Transaction) None
- static post(session, transaction: python_accounting.models.Transaction) None
Posts the Transaction to the ledger.
- Parameters:
session (Session) – The accounting session to which the Account belongs.
transaction (Transaction) – The Transaction to be posted.
- get_hash(connection) None
Calculate the hash of the Ledger.
- Parameters:
connection (Connection) – The database connection of the accounting session
belongs. (to which the Ledger) –
- Returns:
None