gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sat Apr 26 18:06:17 EDT 2025


Updated	 via  https://github.com/Gnucash/gnucash/commit/e81d2846 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/008980c4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/479ecc7b (commit)
	from  https://github.com/Gnucash/gnucash/commit/cfbd7430 (commit)



commit e81d2846192a368096d00e645d5cad1fffc88ced
Merge: cfbd743053 008980c497
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Apr 26 15:03:05 2025 -0700

    Merge featherfeet's 'fix-get-invoice-from-transaction-python' into stable.


commit 008980c49787e6366ad81f17eea461506a711979
Author: Oliver Lok Trevor <featherfeet5436 at gmail.com>
Date:   Thu Apr 24 20:02:54 2025 -0400

    Added unit test

diff --git a/bindings/python/tests/test_business.py b/bindings/python/tests/test_business.py
index 4baea45a9f..9f176756ce 100644
--- a/bindings/python/tests/test_business.py
+++ b/bindings/python/tests/test_business.py
@@ -74,5 +74,14 @@ class TestBusiness(BusinessSession):
     def test_commodities(self):
         self.assertTrue( self.currency.equal( self.customer.GetCommoditiesList()[0] ) )
 
+    def test_invoice_transaction(self):
+        """
+        Test that you can get the posted transaction from a posted invoice and that you can get the invoice back from the transaction.
+        """
+        posted_transaction = self.invoice.GetPostedTxn()
+        self.assertTrue( posted_transaction != None )
+        invoice_from_transaction = posted_transaction.GetInvoiceFromTxn()
+        self.assertTrue( invoice_from_transaction != None and invoice_from_transaction.GetID() == self.invoice.GetID() )
+
 if __name__ == '__main__':
     main()

commit 479ecc7b2b9603fceab4fb151d3f3ffb85534578
Author: Oliver Lok Trevor <featherfeet5436 at gmail.com>
Date:   Thu Apr 10 18:51:54 2025 -0400

    Fixed GetInvoiceFromTxn to convert to the right type of Python object for a GncInvoice.

diff --git a/bindings/python/gnucash_core.py b/bindings/python/gnucash_core.py
index 993ad8919b..6ee86786f9 100644
--- a/bindings/python/gnucash_core.py
+++ b/bindings/python/gnucash_core.py
@@ -822,9 +822,9 @@ class Transaction(GnuCashCoreClass):
         return self.GetSplitList().pop(n)
 
     def GetInvoiceFromTxn(self):
-        from gnucash.gnucash_business import Transaction
+        from gnucash.gnucash_business import Invoice
         return self.do_lookup_create_oo_instance(
-            gncInvoiceGetInvoiceFromTxn, Transaction )
+            gncInvoiceGetInvoiceFromTxn, Invoice )
 
     def __eq__(self, other):
         return self.Equal(other, True, False, False, False)



Summary of changes:
 bindings/python/gnucash_core.py        | 4 ++--
 bindings/python/tests/test_business.py | 9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list