Acquire.Accounting._transactioninfo module

class TransactionInfo(key=None)[source]

Bases: object

This class is used to encode and extract the type of transaction and value to/from an object store key

dated_uid()[source]

Return the full dated uid of the transaction. This is isoformat(datetime)/uid

datetime()[source]

Return the datetime of this transaction

static encode(code, value, receipted_value=None)[source]

Encode the passed code and value into a simple string that can be used as part of an object store key. If ‘receipted_value’ is passed, then encode the receipted value of the provisional transaction too

static from_key(key)[source]

Extract information from the passed object store key.

This looks for a string that is;

isoformat_datetime/UID/transactioncode

where transactioncode is a string that matches ‘2 letters followed by a number’

CL000100.005000 DR000004.234100

etc.

For sent and received receipts there are two values; the receipted value and the original estimate. These have the standard format if the values are the same, e.g.

RR000100.005000

however, they have original value T receipted value if they are different, e.g.

RR000100.005000T000090.000000

Parameters:key – Object store key
is_accounts_receivable()[source]

Return whether or not this is accounts receivable

Returns:True if this is accounts receivable, else False
Return type:bool
is_credit()[source]

Return whether or not this is a credit

Returns:True if this is a credit, else False
Return type:bool
is_debit()[source]

Return whether or not this is a debit

Returns:True if this is a debit, else False
Return type:bool
is_liability()[source]

Return whether or not this is a liability

Returns:True if this is a liability, else False
Return type:bool
is_received_receipt()[source]

Return whether or not this is a received receipt

Returns:True if this is a received receipt, else False
Return type:bool
is_received_refund()[source]

Return whether or not this is a received refund

Returns:True if this is a received refund, else False
Return type:bool
is_sent_receipt()[source]

Return whether or not this is a sent receipt

Returns:True if this is accounts receivable, else False
Return type:bool
is_sent_refund()[source]

Return whether or not this is a sent refund

Returns:True if this is a sent refund, else False
Return type:bool
original_value()[source]

Return the original (pre-receipted) value of the transaction

receipted_value()[source]

Return the receipted value of the transaction. This may be different to value() when the transaction was provisional, and the receipted value is less than the provisional value. This returns None if this transaction wasn’t receipted

Returns:Receipted value of Transaction
Return type:Decimal
rescind()[source]

Return a TransactionInfo that corresponds to rescinding this transaction info. This is useful if you want to update the ledger to remove this object (since we can’t delete anything from the ledger)

to_key()[source]

Return this transaction encoded to a key

uid()[source]

Return the UID of this transaction

value()[source]

Return the value of the transaction. This will be the receipted value if this has been set

class TransactionCode[source]

Bases: enum.Enum

An enumeration.

ACCOUNT_RECEIVABLE = 'AR'
CREDIT = 'CR'
CURRENT_LIABILITY = 'CL'
DEBIT = 'DR'
RECEIVED_RECEIPT = 'RR'
RECEIVED_REFUND = 'RF'
SENT_RECEIPT = 'SR'
SENT_REFUND = 'SF'