From c779bcb72fc6221d206d627dd05a9196db3aa444 Mon Sep 17 00:00:00 2001 From: c-holtermann Date: Thu, 4 Apr 2019 17:43:19 +0200 Subject: [PATCH] GetOwner may return project instead of owner --- bindings/python/example_scripts/rest-api/gnucash_simple.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bindings/python/example_scripts/rest-api/gnucash_simple.py b/bindings/python/example_scripts/rest-api/gnucash_simple.py index ad132c8715..1bc56de026 100644 --- a/bindings/python/example_scripts/rest-api/gnucash_simple.py +++ b/bindings/python/example_scripts/rest-api/gnucash_simple.py @@ -171,7 +171,10 @@ def invoiceToDict(invoice): simple_invoice['notes'] = invoice.GetNotes() simple_invoice['active'] = invoice.GetActive() simple_invoice['currency'] = invoice.GetCurrency().get_mnemonic() - simple_invoice['owner'] = vendorToDict(invoice.GetOwner()) + owner = invoice.GetOwner() + if type(owner) == gnucash.gnucash_business.Job: + owner = owner.GetOwner() + simple_invoice['owner'] = vendorToDict(owner) simple_invoice['owner_type'] = invoice.GetOwnerType() simple_invoice['billing_id'] = invoice.GetBillingID() simple_invoice['to_charge_amount'] = invoice.GetToChargeAmount().to_double()