Example #1
0
    Every QofBook contains a GNCPriceDB, accessible via gnc_pricedb_get_db.

    Definition in file gnc-pricedb.h.
    See also https://code.gnucash.org/docs/head/gnc-pricedb_8h.html
    '''

GncPriceDB.add_methods_with_prefix('gnc_pricedb_')
PriceDB_dict =  {
                'lookup_latest' : GncPrice,
                'lookup_nearest_in_time64' : GncPrice,
                'lookup_latest_before_t64' : GncPrice,
                'convert_balance_latest_price' : GncNumeric,
                'convert_balance_nearest_price_t64' : GncNumeric,
                }
methods_return_instance(GncPriceDB,PriceDB_dict)
GncPriceDB.get_prices = method_function_returns_instance_list(
    GncPriceDB.get_prices, GncPrice )


class GncCommodity(GnuCashCoreClass): pass

class GncCommodityTable(GnuCashCoreClass):
    """A CommodityTable provides a way to store and lookup commodities.
    Commodities are primarily currencies, but other tradable things such as
    stocks, mutual funds, and material substances are possible.

    Users of this library should not create their own CommodityTable, instead
    the get_table method from the Book class should be used.

    This table is automatically populated with the GnuCash default commodity's
Example #2
0
    Every QofBook contains a GNCPriceDB, accessible via gnc_pricedb_get_db.

    Definition in file gnc-pricedb.h.
    See also http://code.gnucash.org/docs/head/gnc-pricedb_8h.html
    '''

GncPriceDB.add_methods_with_prefix('gnc_pricedb_')
PriceDB_dict =  {
                'lookup_latest' : GncPrice,
                'lookup_nearest_in_time64' : GncPrice,
                'lookup_latest_before_t64' : GncPrice,
                'convert_balance_latest_price' : GncNumeric,
                'convert_balance_nearest_price_t64' : GncNumeric,
                }
methods_return_instance(GncPriceDB,PriceDB_dict)
GncPriceDB.get_prices = method_function_returns_instance_list(
    GncPriceDB.get_prices, GncPrice )


class GncCommodity(GnuCashCoreClass): pass

class GncCommodityTable(GnuCashCoreClass):
    """A CommodityTable provides a way to store and lookup commodities.
    Commodities are primarily currencies, but other tradable things such as
    stocks, mutual funds, and material substances are possible.

    Users of this library should not create their own CommodityTable, instead
    the get_table method from the Book class should be used.

    This table is automatically populated with the GnuCash default commodity's
Example #3
0
# Owner
GnuCashBusinessEntity.add_methods_with_prefix('gncOwner')

owner_dict = {
    'GetGUID': GUID,
    'GetCustomer': Customer,
    'GetVendor': Vendor,
    'GetEmployee': Employee,
    'GetJob': Job,
    'GetAddr': Address,
    'GetCurrency': GncCommodity,
    'GetEndOwner': GnuCashBusinessEntity,
    'GetBalanceInCurrency': GncNumeric,
}
methods_return_instance(GnuCashBusinessEntity, owner_dict)

methods_return_instance_lists(GnuCashBusinessEntity,
                              {'GetCommoditiesList': GncCommodity})

# Customer
Customer.add_constructor_and_methods_with_prefix('gncCustomer', 'Create')
Customer.add_method('gncOwnerApplyPayment', 'ApplyPayment')

customer_dict = {
    'GetAddr': Address,
    'GetShipAddr': Address,
    'GetDiscount': GncNumeric,
    'GetCredit': GncNumeric,
    'GetTerms': BillTerm,
    'GetCurrency': GncCommodity,
Example #4
0
# Owner
GnuCashBusinessEntity.add_methods_with_prefix('gncOwner')

owner_dict = {
                    'GetGUID' : GUID,
                    'GetCustomer' : Customer,
                    'GetVendor' : Vendor,
                    'GetEmployee' : Employee,
                    'GetJob' : Job,
                    'GetAddr' : Address,
                    'GetCurrency' : GncCommodity,
                    'GetEndOwner': GnuCashBusinessEntity,
                    'GetBalanceInCurrency': GncNumeric,
              }
methods_return_instance(GnuCashBusinessEntity, owner_dict)

methods_return_instance_lists(
    GnuCashBusinessEntity, {
        'GetCommoditiesList': GncCommodity
    })

# Customer
Customer.add_constructor_and_methods_with_prefix('gncCustomer', 'Create')
Customer.add_method('gncOwnerApplyPayment', 'ApplyPayment')

customer_dict = {
                    'GetAddr' : Address,
                    'GetShipAddr' : Address,
                    'GetDiscount' : GncNumeric,
                    'GetCredit' : GncNumeric,