r19431 - gnucash/trunk/src/optional/python-bindings - Bug #625193: Added 'search by ID' in python binding for invoices, customers and bills.

Christian Stimming cstim at code.gnucash.org
Sat Aug 14 16:48:18 EDT 2010


Author: cstim
Date: 2010-08-14 16:48:18 -0400 (Sat, 14 Aug 2010)
New Revision: 19431
Trac: http://svn.gnucash.org/trac/changeset/19431

Added:
   gnucash/trunk/src/optional/python-bindings/utils.c
   gnucash/trunk/src/optional/python-bindings/utils.h
Modified:
   gnucash/trunk/src/optional/python-bindings/Makefile.am
   gnucash/trunk/src/optional/python-bindings/example_scripts/simple_business_create.py
   gnucash/trunk/src/optional/python-bindings/example_scripts/simple_invoice_insert.py
   gnucash/trunk/src/optional/python-bindings/gnucash_core.i
   gnucash/trunk/src/optional/python-bindings/gnucash_core.py
Log:
Bug #625193: Added 'search by ID' in python binding for invoices, customers and bills.

Patch by Mike E and Mark Jenkins:

When creating or appending to invoices, customers and bills, searching by ID is
likely more useful than by GUID.  I've added this functionality to the Python
bindings.

Search by ID using the python code:
tmp = gnucash.gnucash_core_c.search_invoice_on_id(ID,book.instance)
if tmp:
  invoice =  gnucash.gnucash_business.Invoice(instance=tmp)

Use the invoice object as in sample_scripts/simple_invoice_insert.py

I support this patch, but I've made a few improvments of my own.

I switched up the arguments in search_customer_on_id, search_invoice_on_id,
search_bill_on_id to have Book first and ID second. The reason for this was to
make these functions more consistent with the other functions where a search is
done through a book on a particular attribute.

Also added some specific python bindings support to allow this to be used as
methods of Book: Book.CustomerLookupByID, Book.InvoiceLookupByID,
Book.BillLoookupByID.



More information about the gnucash-patches mailing list