Bug 730255 - Python bindings: Assigns bill entries to non-existant invoice.

Add type checking to ensure entry type matches invoice (or bill) type.
This commit is contained in:
Mike Evans 2014-06-01 13:24:20 +01:00
parent d85725c080
commit 7c003f23e4

View File

@ -217,8 +217,16 @@ class Entry(GnuCashCoreClass):
if invoice != None:
invoice.AddEntry(self)
else:
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')