mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Provide wrapper for qof numeric predicate
Python bindings already have some wrapping objects for qof predicates. This adds the one missing for GncNumeric comparisons. Additionally fixes a wrong number for QOF_NUMERIC_MATCH_ANY in example file.
This commit is contained in:
parent
f44d23035e
commit
06e17dfd5c
@ -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).")
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user