some help for working with invoices, used in Python invoice export
More...
Go to the source code of this file.
some help for working with invoices, used in Python invoice export
- Author
- Christoph Holtermann (c.holtermann (at) gmx.de)
- Date
- 2014-11
Credits to Tom Loft for the query to get_all_invoices as used in his REST-Api
Issues:
- get_all_invoices could be added as a method to book Class
- get_all_customers should be a query like get_all_invoices
Definition in file gncinvoicefkt.py.
◆ get_all_customers()
def gncinvoicefkt.get_all_customers |
( |
|
book | ) |
|
Returns all customers in book.
Posts a query to search for all customers.
arguments:
book the gnucash book to work with
Definition at line 100 of file gncinvoicefkt.py.
100 def get_all_customers(book):
101 """Returns all customers in book. 103 Posts a query to search for all customers. 106 book the gnucash book to work with 109 query = gnucash.Query()
110 query.search_for(
'gncCustomer')
115 for result
in query.run():
116 customer_list.append(Customer(instance=result))
◆ get_all_invoices()
def gncinvoicefkt.get_all_invoices |
( |
|
book, |
|
|
|
is_paid = None , |
|
|
|
is_active = None |
|
) |
| |
Returns a list of all invoices in the book.
Posts a query to search for all invoices.
arguments:
book the gnucash book to work with
keyword-arguments:
is_paid int 1 to search for invoices having been paid, 0 for not, None to ignore.
is_active int 1 to search for active invoices
Definition at line 56 of file gncinvoicefkt.py.
56 def get_all_invoices(book, is_paid=None, is_active=None):
57 """Returns a list of all invoices in the book. 59 Posts a query to search for all invoices. 62 book the gnucash book to work with 64 is_paid int 1 to search for invoices having been paid, 0 for not, None to ignore. 65 is_active int 1 to search for active invoices 68 query = gnucash.Query()
69 query.search_for(
'gncInvoice')
73 query.add_boolean_match([gnucash.INVOICE_IS_PAID],
False, gnucash.QOF_QUERY_AND)
75 query.add_boolean_match([gnucash.INVOICE_IS_PAID],
True, gnucash.QOF_QUERY_AND)
81 query.add_boolean_match([
'active'],
False, gnucash.QOF_QUERY_AND)
83 query.add_boolean_match([
'active'],
True, gnucash.QOF_QUERY_AND)
84 elif is_active ==
None:
88 pred_data = gnucash.gnucash_core.QueryInt32Predicate(gnucash.QOF_COMPARE_EQUAL, 1)
89 query.add_term([gnucash.INVOICE_TYPE], pred_data, gnucash.QOF_QUERY_AND)
93 for result
in query.run():
94 invoice_list.append(Invoice(instance=result))
◆ get_all_invoices_from_lots()
def gncinvoicefkt.get_all_invoices_from_lots |
( |
|
account | ) |
|
Return all invoices in account and descendants
This is based on lots. So invoices without lots will be missed.
Definition at line 40 of file gncinvoicefkt.py.
40 def get_all_invoices_from_lots(account):
41 """Return all invoices in account and descendants 43 This is based on lots. So invoices without lots will be missed.""" 45 lot_list=get_all_lots(account)
48 if type(lot).__name__ ==
'SwigPyObject':
49 lot = gnucash.GncLot(instance=lot)
51 invoice=gnucash.gnucash_core_c.gncInvoiceGetInvoiceFromLot(lot.instance)
53 invoice_list.append(Invoice(instance=invoice))
◆ get_all_lots()
def gncinvoicefkt.get_all_lots |
( |
|
account | ) |
|
Return all lots in account and descendants
Definition at line 29 of file gncinvoicefkt.py.
29 def get_all_lots(account):
30 """Return all lots in account and descendants""" 32 descs = account.get_descendants()
34 if type(desc).__name__ ==
'SwigPyObject':
35 desc = gnucash.Account(instance=desc)