Acquire.Accounting._account module

class Account(name=None, description=None, uid=None, aclrules=None, group_name=None, bucket=None)[source]

Bases: object

This class represents a single account in the ledger. It has a balance, and a record of the set of transactions that have been applied.

The account really holds two accounts: the liability account and actual capital account. We combine both together into a single account to ensure that updates occur atomically

All data for this account is stored in the object store

The account has a set of ACLRules that specify who can read and write to the account (writing implies has spend authority), and who owns the account (can change ACLRules)

assert_valid_authorisation(authorisation, resource=None, accept_partial_match=False)[source]

Assert that the passed authorisation is valid for this account

Args:
authorisation (Authorisation): authorisation object to be used for account
Returns:
None
balance(now=None, bucket=None)[source]

Get the balance of the account at ‘now’ (defaults to actually now). This returns a Balance object for the balance, that includes (1) the current real balance of the account, neglecting any outstanding liabilities or accounts receivable, (2) the current total liabilities, and (3) the current total accounts receivable

where ‘liability’ is the current total liabilities, where ‘receivable’ is the current total accounts receivable, and where ‘spent_today’ is how much has been spent today (from midnight until now)

Parameters:bucket – Bucket to use for calculations
description()[source]

Return the description of this account

Returns:Description of account if account not null, else None
Return type:str or None
static from_data(data)[source]

Construct and return an Account from the passed dictionary that has been decoded from json

get_overdraft_limit()[source]

Return the overdraft limit of this account

Returns:Overdraft limit
Return type:Decimal
group_name()[source]

Return the name of the Accounts group in which this account belongs. An Account can only exist in a single Accounts Group at a time

is_beyond_overdraft_limit(bucket=None)[source]

Return whether or not the current balance is beyond the overdraft limit

Args:
TODO bucket (dict, default=None):
Returns:
bool: True if over overdraft limit, else False
is_null()[source]

Return whether or not this is a null account

name()[source]

Return the name of this account

Returns:Name of account if account not null, else None
Return type:str or None
set_group(group, bucket=None)[source]

Set the Accounts group to which this account belongs

set_overdraft_limit(limit, bucket=None)[source]

Set the overdraft limit of this account to ‘limit’

Parameters:
  • limit (int) – Limit to set overdraft to
  • TODO
  • bucket (dict, default=None) –
Returns:

None

to_data()[source]

Return a dictionary that can be encoded to json from this object

uid()[source]

Return the UID for this account.

Returns:UID
Return type:str