Invoice & payment import script

Reuben Cummings reubano at gmail.com
Fri Feb 17 07:44:00 EST 2012


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

> 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.

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?

> 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.

> 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.

> Geert


More information about the gnucash-devel mailing list