Hi, Reuben Cummings <reub...@gmail.com> writes:
> On Feb 17, 2012, at 1:32 PM, Geert Janssens wrote: > >> Op vrijdag 17 februari 2012 12:52:15 schreef Reuben Cummings: >> >> It is for example not clear to me what you are trying to achieve exactly. I >> read that you want to import invoices and payments. But are you only >> interested in creating transactions for it, or do you also want these >> imported >> invoices to be fully integrated in the business functions of GnuCash ? The >> latter certainly requires more than only adding transactions. > > I'm looking for full integration Then you should definitely use the GnuCash APIs and not manipulate the data in the database by hand! >> How does your script work ? Do you use the gnucash (scheme or python) api to >> enter invoices and payments into your gnucash database or are you adding >> those >> directly ? > > Direct database editing. I studied the existing database to see which > tables were involved with invoices and payments and then tried to > duplicate what I saw. So far, I enter rows into the following tables: > entries, invoices, lots, splits, and transactions. I create my own > guids using an md5 hash. I have so far successfully imported posted > invoices but they display '?' instead of 'I' in the register. You're missing all the ancillary metadata in the KVPs. This means your invoices are malformed. > I wasn't aware of an api. Where would I find out how to convert my > scripts to use the api? I found > http://svn.gnucash.org/docs/HEAD/python_bindings_page.html is that the > best source? Right now the best source is probably the source code. The URL you quote might be a starting point, but none of the bindings docs are "complete", because the bindings are automated. There are no e.g. Scheme or Python binding API docs. >> The latter is not a good idea, since you will be bypassing all the >> business logic and sanity checks that are run when using the gnucash api. >> >> And apart from that, to me the bi-importer plugin seems to do a similar >> thing. >> It's not built by default though, so you will have to build gnucash >> yourself. >> Have you considered using this plugin or is it doing something totally >> different ? > > I've tried with little success. Using the example from > http://svn.gnucash.org/docs/guide/python-import-invoices.html I was > only able to import about half of the entries. Also, the resulting > invoice is un-posted and you still have to manually enter the > payments. I want to import posted invoices as well as the associated > payments. Well, I still recommend you start from here and work with that base rather than writing into the DB. Fix the code to import the rest of your data. As for posting; there is a lot more to posting than just creating the transaction. Why are you trying to import a posted invoice, anyways? At best you would do it once. But you could still automated the process by calling the Post API directly. >> I hope I'm not discouraging you with all these questions and warnings... I >> would just like you to end up with a script that is safe and future proof to >> use. > > I understand. I am happy to use the official channels of writing data > since I don't want to mess up my .gnucash file. And the official channel is the GnuCash API. >> Geert -derek -- Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory Member, MIT Student Information Processing Board (SIPB) URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH warl...@mit.edu PGP key available _______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel