Expose InvoiceNextID to python bindings.

Accessed as book.InvoiceNextID(customer)

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22138 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Mike Evans 2012-04-04 08:35:27 +00:00
parent 96b9031d6b
commit 731f17da50
4 changed files with 18 additions and 3 deletions

View File

@ -39,7 +39,7 @@ gchar *gncInvoiceNextID (QofBook *book, const GncOwner *owner);
void gncInvoiceSetPostedAcc (GncInvoice *invoice, Account *acc);
void gncInvoiceSetPostedTxn (GncInvoice *invoice, Transaction *txn);
void gncInvoiceSetPostedLot (GncInvoice *invoice, GNCLot *lot);
void gncInvoiceSetPaidTxn (GncInvoice *invoice, Transaction *txn);
//void gncInvoiceSetPaidTxn (GncInvoice *invoice, Transaction *txn);
#define gncInvoiceSetGUID(I,G) qof_instance_set_guid(QOF_INSTANCE(I),(G))
#endif /* GNC_INVOICEP_H_ */

View File

@ -124,7 +124,7 @@ endif
noinst_DATA = .py-links
CLEANFILES = $(BUILT_SOURCES) .py-links
CLEANFILES = $(BUILT_SOURCES) .py-links gnucash_core.c gnucash_core.c.py
clean-local:
rm -rf gnucash

View File

@ -71,6 +71,7 @@
#include "gncBillTerm.h"
#include "gncOwner.h"
#include "gncInvoice.h"
#include "gncInvoiceP.h"
#include "gncJob.h"
#include "gncEntry.h"
#include "gncTaxTable.h"
@ -194,6 +195,7 @@
%include <gncAddress.h>
%include <gncBillTerm.h>
%include <gncInvoice.h>
%include <gncInvoiceP.h>
%include <gncJob.h>
%include <gncEntry.h>
%include <gncTaxTable.h>

View File

@ -40,7 +40,7 @@ from gnucash_core_c import gncInvoiceLookup, gncInvoiceGetInvoiceFromTxn, \
gncInvoiceGetInvoiceFromLot, gncEntryLookup, gncInvoiceLookup, \
gncCustomerLookup, gncVendorLookup, gncJobLookup, gncEmployeeLookup, \
gncTaxTableLookup, gncTaxTableLookupByName, gnc_search_invoice_on_id, \
gnc_search_customer_on_id, gnc_search_bill_on_id , gnc_search_vendor_on_id
gnc_search_customer_on_id, gnc_search_bill_on_id , gnc_search_vendor_on_id, gncInvoiceNextID
class GnuCashCoreClass(ClassFromFunctions):
_module = gnucash_core_c
@ -223,6 +223,18 @@ class Book(GnuCashCoreClass):
from gnucash_business import Vendor
return self.do_lookup_create_oo_instance(
gnc_search_vendor_on_id, Vendor, id)
def InvoiceNextID(self, customer):
''' Return the next invoice ID.
This works but I'm not entirely happy with it. FIX ME'''
from gnucash.gnucash_core_c import gncInvoiceNextID
return gncInvoiceNextID(self.get_instance(),customer.GetEndOwner().get_instance()[1])
def BillNextID(self, vendor):
''' Return the next Bill ID. '''
from gnucash.gnucash_core_c import gncInvoiceNextID
return gncInvoiceNextID(self.get_instance(),vendor.GetEndOwner().get_instance()[1])
class GncNumeric(GnuCashCoreClass):
"""Object used by GnuCash to store all numbers. Always consists of a
@ -466,6 +478,7 @@ Book.add_method('gnc_book_get_root_account', 'get_root_account')
Book.add_method('gnc_book_set_root_account', 'set_root_account')
Book.add_method('gnc_commodity_table_get_table', 'get_table')
Book.add_method('gnc_pricedb_get_db', 'get_price_db')
Book.add_method('qof_book_increment_and_format_counter', 'increment_and_format_counter')
#Functions that return Account
Book.get_root_account = method_function_returns_instance(