After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 625193 - Added 'search by ID' for invoices, customers and bills.
Added 'search by ID' for invoices, customers and bills.
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Python Bindings
git-master
Other Linux
: Normal enhancement
: ---
Assigned To: Mark Jenkins
Mark Jenkins
Depends on:
Blocks:
 
 
Reported: 2010-07-24 15:16 UTC by Mike Evans
Modified: 2018-06-29 22:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adds search by Invoice_Bill_Customer_ID to python bindings (10.60 KB, patch)
2010-07-24 15:16 UTC, Mike Evans
accepted-commit_now Details | Review
Patch for python bindings to add search by ID (10.25 KB, patch)
2010-07-29 07:38 UTC, Mike Evans
none Details | Review
Enhanced patch that supports searching for Customer, Invoice, and Bill by ID (12.77 KB, patch)
2010-08-02 20:21 UTC, Mark Jenkins
committed Details | Review

Description Mike Evans 2010-07-24 15:16:53 UTC
Created attachment 166490 [details] [review]
Adds search by Invoice_Bill_Customer_ID to python bindings

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
Comment 1 Christian Stimming 2010-07-26 11:01:51 UTC
Comment on attachment 166490 [details] [review]
Adds search by Invoice_Bill_Customer_ID to python bindings

(But there is a small typo in src/optional/python-bindings/Makefile.am in the second-to-last hunk where "xample_scripts" is missing an "e".)
Comment 2 Mike Evans 2010-07-29 07:38:28 UTC
Created attachment 166754 [details] [review]
Patch for python bindings to add search by ID

Corrects typo in previous patch.
Comment 3 Mark Jenkins 2010-08-02 20:21:22 UTC
Created attachment 167010 [details] [review]
Enhanced patch that supports searching for Customer, Invoice, and Bill by ID

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.

In the Makefile I removed the dependancy for gnucash_core.c and gnucash_core_c.py on utils.c. Neither of these files have utils.c as a dependency for thier creation. The actual binary library file that is created by compiling gnucash_core.c and utils.c has the dependency on utils.c and utils.h; and Automake already takes care of that via the appearance of utils.c in _gnucash_core_c_la_SOURCES.
Comment 4 Mark Jenkins 2010-08-02 21:04:24 UTC
> I support this patch

What I mean is, I support this patch being commited to trunk.
(can't do that myself)

I've commited this my own svn repository

http://svn.parit.ca/gnucash/branches/python-bindings@579
http://svn.parit.ca/gnucash/branches/python-bindings-invoicesearch@578
Comment 5 Mike Evans 2010-08-02 21:45:45 UTC
Makes sense to me.  Maybe my choice of utils.c as a file name could have been better though.
Comment 6 Mark Jenkins 2010-08-02 22:03:14 UTC
It's also possible that such searching C code (as found in utils.c) should have a place in gnucash generally and not the python bindings specifically so it can be available to users of the GnuCash C api and other future language bindings that come along. (the python bindings would just link to and use it like the rest of the C api instead of hard building it into the python bindings module)

No language binding specific C code appears in utils.c, which does kind of imply that it shouldn't be included in the language binding module specifically.

But that can be done another time. For now this could be applied and refined later.
Comment 7 Mike Evans 2010-08-02 22:29:39 UTC
I agree that it is a useful function to add to the core code.  For the origin and proper attribution of the code see Bug 624911.  Perhaps a little late to include it so near to a 2.4 release though?
Comment 8 Christian Stimming 2010-08-14 20:48:51 UTC
Comment on attachment 167010 [details] [review]
Enhanced patch that supports searching for Customer, Invoice, and Bill by ID

r19431
Comment 9 Christian Stimming 2010-08-14 20:51:04 UTC
Thanks a lot!

(Moving the general functions from optional to the core is a good idea. This can even be done while we're in the preparation of 2.4.0, because the new function isn't used anywhere inside the rest of gnucash. Just go ahead and submit a patch. Thanks!)
Comment 10 Mike Evans 2010-08-15 16:02:40 UTC
Would Mark be willing to do that?  I am a bit vague as to where to insert this and as to proper naming conventions for core functions etc.  
N.B. This crosses over with Bug 624911.
Comment 11 John Ralls 2018-06-29 22:42:12 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=625193. Please update any external references or bookmarks.