diff --git a/bindings/python/example_scripts/qof.py b/bindings/python/example_scripts/qof.py index 8d009548bc..5f138137bb 100644 --- a/bindings/python/example_scripts/qof.py +++ b/bindings/python/example_scripts/qof.py @@ -161,7 +161,7 @@ with Session(uri, SessionOpenMode.SESSION_NEW_STORE) as ses: # query split value threshold = GncNumeric(5000, 100) - QOF_NUMERIC_MATCH_ANY = 1 - terms = [(["amount"], gnucash_core_c.qof_query_numeric_predicate(QOF_COMPARE_GT, QOF_NUMERIC_MATCH_ANY, threshold.instance), QOF_QUERY_AND)] + QOF_NUMERIC_MATCH_ANY = 3 + terms = [(["amount"], gnucash_core.QueryNumericPredicate(QOF_COMPARE_GT, QOF_NUMERIC_MATCH_ANY, threshold), QOF_QUERY_AND)] splits_3 = query_splits(book, terms) print("Query splits with amount > " + str(threshold) + ": " + str(len(splits_3)) + " (Should be about 50).") diff --git a/bindings/python/gnucash_core.py b/bindings/python/gnucash_core.py index b4d7126b79..5ac3b6562f 100644 --- a/bindings/python/gnucash_core.py +++ b/bindings/python/gnucash_core.py @@ -967,3 +967,9 @@ class QueryGuidPredicate(GnuCashCoreClass): QueryGuidPredicate.add_constructor_and_methods_with_prefix( 'qof_query_', 'guid_predicate') + +class QueryNumericPredicate(GnuCashCoreClass): + pass + +QueryNumericPredicate.add_constructor_and_methods_with_prefix( + 'qof_query_', 'numeric_predicate')