r22138 - gnucash/trunk/src - Expose InvoiceNextID to python bindings.

Mike Evans mikee at code.gnucash.org
Wed Apr 4 04:35:27 EDT 2012


Author: mikee
Date: 2012-04-04 04:35:27 -0400 (Wed, 04 Apr 2012)
New Revision: 22138
Trac: http://svn.gnucash.org/trac/changeset/22138

Modified:
   gnucash/trunk/src/engine/gncInvoiceP.h
   gnucash/trunk/src/optional/python-bindings/Makefile.am
   gnucash/trunk/src/optional/python-bindings/gnucash_core.i
   gnucash/trunk/src/optional/python-bindings/gnucash_core.py
Log:
Expose InvoiceNextID to python bindings.
Accessed as book.InvoiceNextID(customer)

Modified: gnucash/trunk/src/engine/gncInvoiceP.h
===================================================================
--- gnucash/trunk/src/engine/gncInvoiceP.h	2012-04-03 21:36:07 UTC (rev 22137)
+++ gnucash/trunk/src/engine/gncInvoiceP.h	2012-04-04 08:35:27 UTC (rev 22138)
@@ -39,7 +39,7 @@
 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_ */

Modified: gnucash/trunk/src/optional/python-bindings/Makefile.am
===================================================================
--- gnucash/trunk/src/optional/python-bindings/Makefile.am	2012-04-03 21:36:07 UTC (rev 22137)
+++ gnucash/trunk/src/optional/python-bindings/Makefile.am	2012-04-04 08:35:27 UTC (rev 22138)
@@ -124,7 +124,7 @@
 
 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

Modified: gnucash/trunk/src/optional/python-bindings/gnucash_core.i
===================================================================
--- gnucash/trunk/src/optional/python-bindings/gnucash_core.i	2012-04-03 21:36:07 UTC (rev 22137)
+++ gnucash/trunk/src/optional/python-bindings/gnucash_core.i	2012-04-04 08:35:27 UTC (rev 22138)
@@ -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>

Modified: gnucash/trunk/src/optional/python-bindings/gnucash_core.py
===================================================================
--- gnucash/trunk/src/optional/python-bindings/gnucash_core.py	2012-04-03 21:36:07 UTC (rev 22137)
+++ gnucash/trunk/src/optional/python-bindings/gnucash_core.py	2012-04-04 08:35:27 UTC (rev 22138)
@@ -40,7 +40,7 @@
     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 @@
         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_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(



More information about the gnucash-changes mailing list