Nice example python scripts, patch by Mark Jenkins.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19314 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens
2010-06-30 19:26:57 +00:00
parent eaf3c5cbf8
commit c84e7c381c
4 changed files with 597 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env python
from gnucash import Session, Account
from os.path import abspath
from gnucash.gnucash_core_c import ACCT_TYPE_ASSET
s = Session('sqlite3://%s' % abspath('test.blob'), True)
# this seems to make a difference in more complex cases
s.save()
book = s.book
root = book.get_root_account()
a = Account(book)
root.append_child(a)
a.SetName('wow')
a.SetType(ACCT_TYPE_ASSET)
commod_table = book.get_table()
a.SetCommodity( commod_table.lookup('CURRENCY', 'CAD') )
s.save()
s.end()