gnucash maint: Bug 730255 - Python bindings: Assigns bill entries to non-existant invoice.
Mike Evans
mikee at code.gnucash.org
Sun Jun 1 08:18:50 EDT 2014
Updated via https://github.com/Gnucash/gnucash/commit/7c003f23 (commit)
from https://github.com/Gnucash/gnucash/commit/d85725c0 (commit)
commit 7c003f23e4350f089fdb8ae47fbf32ad82f18834
Author: Mike Evans <mikee at millstreamcomputing.co.uk>
Date: Sun Jun 1 13:24:20 2014 +0100
Bug 730255 - Python bindings: Assigns bill entries to non-existant invoice.
Add type checking to ensure entry type matches invoice (or bill) type.
diff --git a/src/optional/python-bindings/gnucash_business.py b/src/optional/python-bindings/gnucash_business.py
index e3b3948..930c6d8 100644
--- a/src/optional/python-bindings/gnucash_business.py
+++ b/src/optional/python-bindings/gnucash_business.py
@@ -217,7 +217,15 @@ class Entry(GnuCashCoreClass):
if invoice != None:
invoice.AddEntry(self)
else:
- GnuCashCoreClass.__init__(self, instance=instance)
+
+ GnuCashCoreClass.__init__(self, instance=instance)
+
+ def test_type(self, invoice):
+ if invoice.GetTypeString() == "Invoice" and self.GetInvoice() == None:
+ raise Exception("Entry type error. Check that Entry type matches Invoice.")
+ if invoice.GetTypeString() == "Bill" and self.GetBill() == None:
+ raise Exception("Entry type error. Check that Entry type matches Bill.")
+
# Owner
GnuCashBusinessEntity.add_methods_with_prefix('gncOwner')
Summary of changes:
src/optional/python-bindings/gnucash_business.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
More information about the gnucash-changes
mailing list