piecash.core.transaction module — Python interface to GnuCash documents 0.15.0 documentation

# 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)

  Bases: `piecash._declbase.DeclarativeBaseGuid`

  A GnuCash Split.

  Note

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

  `transaction`

    `piecash.core.transaction.Transaction` – transaction of the split

  `account`

    `piecash.core.account.Account` – account of the split

  `lot`

    `piecash.business.Lot` – lot to which the split pertains

  `memo`

    str – memo of the split

  `value`

    `decimal.Decimal` – amount express in the currency of the transaction of the split

  `quantity`

    `decimal.Decimal` – amount express in the commodity of the account of the split

  `reconcile_state`

    str – ‘n’, ‘c’ or ‘y’

  `reconcile_date`

    `datetime.datetime` – time

  `action`

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

  `object_to_validate`(change)

    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`()

    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='')

  Bases: `piecash._declbase.DeclarativeBaseGuid`

  A GnuCash Transaction.

  `currency`

    `piecash.core.commodity.Commodity` – currency of the transaction. This attribute is write-once (i.e. one cannot change it after being set)

  `description`

    str – description of the transaction

  `enter_date`

    `datetime.datetime` – datetimetime at which transaction is entered

  `post_date`

    `datetime.date` – day on which transaction is posted

  `num`

    str – user provided transaction number

  `splits`

    list of `Split` – list of the splits of the transaction

  `scheduled_transaction`

    `ScheduledTransaction` – scheduled transaction behind the transaction

  `notes`

    str – notes on the transaction (provided via a slot)

  `object_to_validate`(change)

    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`()

    This must be reimplemented for object requiring validation

  `calculate_imbalances`()

    Calculate value and quantity imbalances of a transaction

class `piecash.core.transaction.` `ScheduledTransaction`(*args, **kwargs)

  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)

  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`

    int – 1 if lot is closed, 0 otherwise

  `account`

    `piecash.core.account.Account` – account of the Lot

  `splits`

    `piecash.core.transaction.Split` – splits associated to the Lot

  `object_to_validate`(change)

    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`()

    This must be reimplemented for object requiring validation