Python list all invoices

Tom Lofts dev at loftx.co.uk
Mon Nov 10 14:57:29 EST 2014


Hi Christoph,

While the query api isn’t available in Python yet, I’ve made some steps 
towards this for the REST API I’ve been working on. Some of this code is 
already available in the latest version of Gnucash, mostly in the Python 
examples directory at 
https://github.com/Gnucash/gnucash/blob/master/src/optional/python-bindings/example_scripts/rest-api/gnucash_rest.py

The code you’ll want is getInvoices which creates a query which then 
adds a condition to check for paid/unpaid and active/inactive invoices.

I’ve done a little more work which I haven’t made available publicly 
yet, but a work in progress version of this function is also attached.

If you have any queries please let me know.

Kind regards,

Tom


On 10/11/14 15:10, Christoph Holtermann wrote:
> Dear developers,
>
> to get my invoices to LaTeX I went to jinja2 templating engine
> which works quite fine.
> src/optional/python-bindings/example_scripts/gncinvoice_jinja.py
> https://github.com/c-holtermann/gnucash/commit/15a69f120569a174837b467d54a22fb1b4345777
>
> I want to be able to show a list of all invoices to select which one to extract.
> This leads to my question:
>
> What ways are there to list all invoices (with python) ?
>
> I first went through all lots to get corresponding invoices - which leaves all
> invoices without transactions. Did this in latex_invoices.py.
> Then I realized that in the python business bindings there is
> InvoiceLookupByID which is a good way to access invoices.
> But it's not possible by this way to know all IDs.
>
> When I use the way similar to the search dialogue like "all invoices
> after 1970 january" I would probably get all invoices. But as far as I
> know the query api is not yet open to python, is it ?
>
> Is there another way to get all invoices ?
>
> regards,
>
> Christoph Holtermann
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getinvoices-snippet.py
Type: text/x-python
Size: 1714 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20141110/0bb61e31/attachment.py>


More information about the gnucash-devel mailing list