diff --git a/bindings/python/gnucash_business.py b/bindings/python/gnucash_business.py index f2e47e677e..53b8e1b345 100644 --- a/bindings/python/gnucash_business.py +++ b/bindings/python/gnucash_business.py @@ -374,3 +374,6 @@ methods_return_instance(Entry, entry_dict) Entry.decorate_functions( decorate_to_return_instance_instead_of_owner, 'GetBillTo' ) + +from gnucash.gnucash_core import decorate_monetary_list_returning_function +Entry.decorate_functions(decorate_monetary_list_returning_function, 'GetBalTaxValues') diff --git a/bindings/python/gnucash_core.py b/bindings/python/gnucash_core.py index c1863bd1b9..b268503ebb 100644 --- a/bindings/python/gnucash_core.py +++ b/bindings/python/gnucash_core.py @@ -435,12 +435,22 @@ class Transaction(GnuCashCoreClass): gncInvoiceGetInvoiceFromTxn, Transaction ) def decorate_monetary_list_returning_function(orig_function): - def new_function(self): + def new_function(self, *args): + """decorate function that returns list of gnc_monetary to return tuples of GncCommodity and GncNumeric + + Args: + *args: Variable length argument list. Will get passed to orig_function + + Returns: + array of tuples: (GncCommodity, GncNumeric) + + ToDo: + Maybe this function should better reside in module function_class (?)""" # warning, item.commodity has been shown to be None # when the transaction doesn't have a currency return [(GncCommodity(instance=item.commodity), GncNumeric(instance=item.value)) - for item in orig_function(self) ] + for item in orig_function(self, *args) ] return new_function class Split(GnuCashCoreClass):