-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Tom,
Thanks a lot for your explanations. I am very glad to see that this is something that is being developed right now. Keep up the good work! Thanks, Jonas - -------- Original Message -------- Subject: Re: List all customers with Python bindings From: Tom Lofts <d...@loftx.co.uk> To: jo...@lippuner.ca Cc: gnucash-devel@gnucash.org Date: Tue 04 Jun 2013 01:36:56 AM PDT > Hi Jonas, > > Gnucash uses the Query Object Framework > (http://svn.gnucash.org/docs/HEAD/group__QOF.html) to return a > number of customers (or other types of data) and allows various > conditions to be applied to the data returned. > > Unfortunately I believe this is not completely implemented in the > Python bindings yet, though I have made a start over the last > month, so that it is not possible to return the information you > require. > > You'll need to be using the unstable Gnucash release (at least > 2.5.1), as this has a number of additional functions in the Query > class you'll need to use. You should then find you can use the > following: > > query = gnucash.Query() query.search_for('gncCustomer') > query.set_book(book) customers = [] > > for result in query.run(): > customers.append(gnucash.gnucash_business.Customer(instance=result)) > > query.destroy() > > Which will return you a list of Customer objects if you pass a Book > Object into query.set_book() > > This code comes from the REST API example at > https://github.com/Gnucash/gnucash/tree/trunk/src/optional/python-bindings/example_scripts/rest-api > which I have been working on so you may find some more help here. > > Kind regards, > > Tom > > -----Original Message----- From: > gnucash-devel-bounces+dev=loftx.co...@gnucash.org > [mailto:gnucash-devel-bounces+dev=loftx.co...@gnucash.org] On > Behalf Of Jonas Lippuner Sent: 03 June 2013 09:57 To: > gnucash-devel@gnucash.org Subject: List all customers with Python > bindings > > Dear Developers, > > How do I get a list of all customers (or all vendors, invoices, > bills etc.) using the Python bindings? I see from examples how I > can get a specific customer using book.LookupByID, but this > requires that I know the GUID of the customer. > > Alternatively, is there a way to get a list of all GUIDs? Then I > can simply go through all of them and filter out the customers... > > > Thanks, Jonas > > _______________________________________________ gnucash-devel > mailing list gnucash-devel@gnucash.org > https://lists.gnucash.org/mailman/listinfo/gnucash-devel > > - -- My email is signed and I encrypt email on request. To verify my signature or send me encrypted email, get my public key: http://lippuner.ca/key -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRrpSyAAoJELH92qHy0gnt5K8P/2bQEHbpLEgvdK+eu3fiMtt+ FwXfbYNUe3ixnAw3PKIrmXnsVkQoNsKG/mBeBS/M+qlQV0CXwuySYPxQTc1cajmL D8dqIEhUq6TyEoR3WLl0lhf5BZqh149023D/ZIVs2GiPzRPL+Iux/bXExh/5FnOu t/RZw0duIcPmlGSBFc8c/xDh7SG7XLm/7JpymgS0yQFYa64YuENIPUAN/SLZT9I7 dHIxGMF7uR0Qdal74QkfhuHvv0RzXQcTIa+RxK3TvJve9dXy2DCQ0/UsOqvNZRDD Q3P0TF8vUlpX/NsILQObsRVFZGY7cXjYi+veF4piy/8cWsdkWSO/m2vRN+inxVWy OfHmp9STuz9xANCCM4VUlcDcukbRXkuAtJTaE5iotg2iUpGVyDnpBBFUQkjTbwag y2KREGs+hUGVRNVdn3OHuaD/K7aW65kBrUdULNcs4MPqDeOsP6yLBf8E5uza1Dms 28WRSelzjkqUuJ+EWjzMnWmZXcxYf/tiiEgJ2yjhGjHi77c9bHo1q5Pu3/5ztYxy X8YGXWSlnYYMwxQTzjUOwQuuK64/ij5vVLC67CoA+mhopyVOyKHPVX1Cym0NAYW8 UCHyWLweM8CfwsDFVmMsuCLLyiAfwFIruZFiS7vg3LBe3Qa6xhzp/KjCBOXKeLJe 8NDZKSwEsO0BowYD2496 =1KQM -----END PGP SIGNATURE----- _______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel