[GNC] How To Get Job Object?

Robert Simmons rsimmons0 at gmail.com
Wed Aug 10 20:59:46 EDT 2022


When I'm done with all this, I'm going to contribute new example scripts.
The current documentation for the Python bindings is very excellent. It's
some of the best documentation I've ever seen. It's a pleasure to use and
saves a ton of time.

Here is the only way that I can find of getting from zero to the job that I
want and then associate that job with an invoice:

import gnucash
import gnucash.gnucash_business

def get_jobs(book):
    query = gnucash.Query()
    query.search_for('gncJob')
    query.set_book(book)
    job_list = list()
    for result in query.run():
        job_list.append(gnucash.gnucash_business.Job(instance=result))
    query.destroy()
    return job_list

The resulting list is objects with the expected methods. You then loop
through them and find the one you're looking for.


More information about the gnucash-user mailing list