piecash.core.transaction module

class piecash.core.transaction.Split(account, value, quantity=None, transaction=None, memo='', action='', reconcile_date=None, reconcile_state='n', lot=None)[source]

Bases: piecash._declbase.DeclarativeBaseGuid

A GnuCash Split.

Note

A split used in a scheduled transaction has its main attributes in form of slots.

transaction

transaction of the split

Type

piecash.core.transaction.Transaction

account

account of the split

Type

piecash.core.account.Account

lot

lot to which the split pertains

Type

piecash.business.Lot

memo

memo of the split

Type

str

value

amount express in the currency of the transaction of the split

Type

decimal.Decimal

quantity

amount express in the commodity of the account of the split

Type

decimal.Decimal

reconcile_state

‘n’, ‘c’ or ‘y’

Type

str

reconcile_date

time

Type

datetime.datetime

action

describe the type of action behind the split (free form string but with dropdown in the GUI

Type

str

object_to_validate(change)[source]

yield the objects to validate when the object is modified (change=”new” “deleted” or “dirty”).

For instance, if the object is a Split, if it changes, we want to revalidate not the split but its transaction and its lot (if any). split.object_to_validate should yeild both split.transaction and split.lot

validate()[source]

This must be reimplemented for object requiring validation

class piecash.core.transaction.Transaction(currency, description='', notes=None, splits=None, enter_date=None, post_date=None, num='')[source]

Bases: piecash._declbase.DeclarativeBaseGuid

A GnuCash Transaction.

currency

currency of the transaction. This attribute is write-once (i.e. one cannot change it after being set)

Type

piecash.core.commodity.Commodity

description

description of the transaction

Type

str

enter_date

datetimetime at which transaction is entered

Type

datetime.datetime

post_date

day on which transaction is posted

Type

datetime.date

num

user provided transaction number

Type

str

splits

list of the splits of the transaction

Type

list of Split

scheduled_transaction

scheduled transaction behind the transaction

Type

ScheduledTransaction

notes

notes on the transaction (provided via a slot)

Type

str

object_to_validate(change)[source]

yield the objects to validate when the object is modified (change=”new” “deleted” or “dirty”).

For instance, if the object is a Split, if it changes, we want to revalidate not the split but its transaction and its lot (if any). split.object_to_validate should yeild both split.transaction and split.lot

validate()[source]

This must be reimplemented for object requiring validation

calculate_imbalances()[source]

Calculate value and quantity imbalances of a transaction

class piecash.core.transaction.ScheduledTransaction(*args, **kwargs)[source]

Bases: piecash._declbase.DeclarativeBaseGuid

A GnuCash Scheduled Transaction.

Attributes

adv_creation (int) : days to create in advance (0 if disabled) adv_notify (int) : days to notify in advance (0 if disabled) auto_create (bool) : auto_notify (bool) : enabled (bool) : start_date (datetime.datetime) : date to start the scheduled transaction last_occur (datetime.datetime) : date of last occurence of the schedule transaction end_date (datetime.datetime) : date to end the scheduled transaction (num/rem_occur should be 0) instance_count (int) : name (str) : name of the scheduled transaction num_occur (int) : number of occurences in total (end_date should be null) rem_occur (int) : number of remaining occurences (end_date should be null) template_account (piecash.core.account.Account): template account of the transaction

class piecash.core.transaction.Lot(title, account, notes='', splits=None, is_closed=0)[source]

Bases: piecash._declbase.DeclarativeBaseGuid

A GnuCash Lot. Each lot is linked to an account. Splits in this account can be associated to a Lot. Whenever the balance of the splits goes to 0, the Lot is closed (otherwise it is opened)

is_closed

1 if lot is closed, 0 otherwise

Type

int

account

account of the Lot

Type

piecash.core.account.Account

splits

splits associated to the Lot

Type

piecash.core.transaction.Split

object_to_validate(change)[source]

yield the objects to validate when the object is modified (change=”new” “deleted” or “dirty”).

For instance, if the object is a Split, if it changes, we want to revalidate not the split but its transaction and its lot (if any). split.object_to_validate should yeild both split.transaction and split.lot

validate()[source]

This must be reimplemented for object requiring validation