Skip to content

statement_models

Qt item models for financial statement tree views.

Classes:

BalanceSheetModel

BalanceSheetModel()

Bases: _StatementModel

Tree: Assets/Liabilities/Equity sections with expandable composite accounts.

Methods:

  • columnCount

    Return number of columns.

  • data

    Return data for the given index and role.

  • flags

    Return item flags for the given index.

  • headerData

    Return header data for the given section and orientation.

  • index

    Return a model index for the given row and column.

  • parent

    Return the parent index of the given index.

  • reset

    Clear all rows from the model.

  • rowCount

    Return number of rows under parent.

  • update

    Populate from a (closed) ChartOfAccounts, walking the account tree.

columnCount

columnCount(parent: QModelIndex = _INVALID) -> int

Return number of columns.

data

data(index: QModelIndex, role: int = DisplayRole) -> Any

Return data for the given index and role.

flags

flags(index: QModelIndex = _INVALID) -> ItemFlag

Return item flags for the given index.

headerData

headerData(
    section: int,
    orientation: Orientation,
    role: int = DisplayRole,
) -> Any

Return header data for the given section and orientation.

index

index(
    row: int, column: int, parent: QModelIndex = _INVALID
) -> QModelIndex

Return a model index for the given row and column.

parent

parent(index: QModelIndex = _INVALID) -> QModelIndex

Return the parent index of the given index.

reset

reset() -> None

Clear all rows from the model.

rowCount

rowCount(parent: QModelIndex = _INVALID) -> int

Return number of rows under parent.

update

update(chart: ChartOfAccounts) -> None

Populate from a (closed) ChartOfAccounts, walking the account tree.

IncomeStatementModel

IncomeStatementModel()

Bases: _StatementModel

Tree: Income/Expenses sections + Net Income row.

Methods:

  • columnCount

    Return number of columns.

  • data

    Return data for the given index and role.

  • flags

    Return item flags for the given index.

  • headerData

    Return header data for the given section and orientation.

  • index

    Return a model index for the given row and column.

  • parent

    Return the parent index of the given index.

  • reset

    Clear all rows from the model.

  • rowCount

    Return number of rows under parent.

  • update

    Populate from an unclosed ChartOfAccounts.

columnCount

columnCount(parent: QModelIndex = _INVALID) -> int

Return number of columns.

data

data(index: QModelIndex, role: int = DisplayRole) -> Any

Return data for the given index and role.

flags

flags(index: QModelIndex = _INVALID) -> ItemFlag

Return item flags for the given index.

headerData

headerData(
    section: int,
    orientation: Orientation,
    role: int = DisplayRole,
) -> Any

Return header data for the given section and orientation.

index

index(
    row: int, column: int, parent: QModelIndex = _INVALID
) -> QModelIndex

Return a model index for the given row and column.

parent

parent(index: QModelIndex = _INVALID) -> QModelIndex

Return the parent index of the given index.

reset

reset() -> None

Clear all rows from the model.

rowCount

rowCount(parent: QModelIndex = _INVALID) -> int

Return number of rows under parent.

update

update(chart: ChartOfAccounts) -> None

Populate from an unclosed ChartOfAccounts.

TrialBalanceModel

TrialBalanceModel()

Bases: _StatementModel

Flat table: Account | Debit | Credit, with a bold totals row.

Methods:

  • columnCount

    Return number of columns.

  • data

    Return data for the given index and role.

  • flags

    Return item flags for the given index.

  • headerData

    Return header data for the given section and orientation.

  • index

    Return a model index for the given row and column.

  • parent

    Return the parent index of the given index.

  • reset

    Clear all rows from the model.

  • rowCount

    Return number of rows under parent.

  • update

    Populate from ReportingService.trial_balance() output.

columnCount

columnCount(parent: QModelIndex = _INVALID) -> int

Return number of columns.

data

data(index: QModelIndex, role: int = DisplayRole) -> Any

Return data for the given index and role.

flags

flags(index: QModelIndex = _INVALID) -> ItemFlag

Return item flags for the given index.

headerData

headerData(
    section: int,
    orientation: Orientation,
    role: int = DisplayRole,
) -> Any

Return header data for the given section and orientation.

index

index(
    row: int, column: int, parent: QModelIndex = _INVALID
) -> QModelIndex

Return a model index for the given row and column.

parent

parent(index: QModelIndex = _INVALID) -> QModelIndex

Return the parent index of the given index.

reset

reset() -> None

Clear all rows from the model.

rowCount

rowCount(parent: QModelIndex = _INVALID) -> int

Return number of rows under parent.

update

update(data: list[dict[str, Any]]) -> None

Populate from ReportingService.trial_balance() output.