models.tax

Represents a Tax that is applied to the Line Item of a Transaction.

Module Contents

Classes

Tax

Represents a Tax applied to a Transaction's Line Item.

class models.tax.Tax

Bases: python_accounting.mixins.IsolatingMixin, python_accounting.models.Recyclable

Represents a Tax applied to a Transaction’s Line Item.

__mapper_args__
id: sqlalchemy.orm.Mapped[int]

The primary key of the Tax database record.

Type:

(int)

name: sqlalchemy.orm.Mapped[str]

The label of the Tax.

Type:

(str)

code: sqlalchemy.orm.Mapped[str]

A shorthand representation of the Tax.

Type:

(str)

rate: sqlalchemy.orm.Mapped[decimal.Decimal]

The percentage rate of the Tax.

Type:

(Decimal)

account_id: sqlalchemy.orm.Mapped[int]

The id of the Account model to which Tax amounts are posted.

Type:

(int)

account: sqlalchemy.orm.Mapped[python_accounting.models.Account]

The Account model to which Tax amounts are posted.

Type:

(Account)

__repr__() str
validate(session) None

Validates the Tax properties.

Parameters:

session (Session) – The accounting session to which the Balance belongs.

Raises:
Returns:

None

validate_delete(session) None

Validates if the Tax can be deleted.

Parameters:

session (Session) – The accounting session to which the Tax belongs.

Raises:

HangingTransactionsError – If there exists posted Transactions with Line Items that have this Tax applied to them.

Returns:

None