|
GnuCash 2.4.99
|
00001 #!/usr/bin/env python 00002 ## @file 00003 # @brief Example Script simple sqlite create 00004 # @ingroup python_bindings_examples 00005 00006 from gnucash import Session, Account 00007 from os.path import abspath 00008 from gnucash.gnucash_core_c import ACCT_TYPE_ASSET 00009 00010 s = Session('sqlite3://%s' % abspath('test.blob'), is_new=True) 00011 # this seems to make a difference in more complex cases 00012 s.save() 00013 00014 book = s.book 00015 root = book.get_root_account() 00016 a = Account(book) 00017 root.append_child(a) 00018 a.SetName('wow') 00019 a.SetType(ACCT_TYPE_ASSET) 00020 00021 commod_table = book.get_table() 00022 a.SetCommodity( commod_table.lookup('CURRENCY', 'CAD') ) 00023 s.save() 00024 00025 s.end()
1.7.4