Commit Graph
190 Commits
Author SHA1 Message Date
Geert Janssens e97fc3e408 Drop price-quotes.scm, gnc-fq-helper.in and gnc-fq-check.in - no longer used 2022-10-02 11:50:26 -07:00
Christopher Lam 161b07b241 Merge branch 'maint' 2022-09-09 21:23:40 +08:00
luz paz ba94730a23 Fix various typos
Found via `codespell`
2022-09-06 10:44:29 -04:00
Christopher Lam 0b5a4cd298 Merge branch 'maint' 2022-08-03 20:38:08 +08:00
John Ralls 688832b5f8 Bug 798585 - segfault running sample script
The root cause of which is that on recent releases of GLib (recent
meaning 2.66 in the current Debian stable!) g_type_instance_get_private
looks in the wrong place for the private data. When running the script
in question it returned NULL and since the code didn't check for a valid
pointer, it crashed.

So this change replaces all calls to g_type_instance_get_private with
the function [type_prefix]_get_instance_private() added in glib-2.36
except for two register2 files that have been removed from master; those
are ignored to avoid unnecessary merge conflicts.
2022-07-30 16:50:51 -07:00
Christopher Lam f1adb5da34 Merge branch 'TXN_TYPE-is-dynamic' xaccTransGetTxnType into maint #1201 2022-07-18 09:24:32 +08:00
Christopher Lam fd12d3900c [Transaction.c] use heuristics to determine txn->txn_type 2022-07-18 09:24:05 +08:00
John Ralls f4c27d4494 Move gnc_ui_account_get_tax_info_string to gnc-locale-tax.c
To prevent a circular dependency between libgnc-app-utils and
libgnucash-guile.
2022-07-17 10:00:23 -07:00
John Ralls 426b30c37e Fix python tests dependencies
So that ninja check works from a clean build directory with Python enabled.
2022-07-16 16:36:46 -07:00
John Ralls 7d94ade599 [python]Remove non-namespace "All non-currency" fom namespace test. 2022-03-25 15:19:57 -07:00
Christoph Holtermann 6a015c8744 make GncNumeric.invert() return GncNumeric 2022-03-20 20:04:56 +01:00
Christoph Holtermann 567df27cc7 Implement some comparisons and arithmetics for GncNumeric
Derive some numeric comparisons and arithmetics from Fraction
class
https://github.com/python/cpython/blob/3.7/Lib/fractions.py
and general information from
https://docs.python.org/3/library/numbers.html#numbers.Integral

These methods are bound closer to the gnucash-C-api than those
from the fraction class.

This is not the full set of comparisons and arithmetics, needs
to be extended. It would be good to extend tests to cover this.
2022-03-20 20:04:44 +01:00
John Ralls cbfacdcd55 Merge Christoff Holtermann's 'python-qof-example' into maint. 2022-03-08 13:46:07 -08:00
John Ralls d841b322d0 Merge Frank Ellenberger's 'Bug684507' into maint. 2022-03-08 12:39:47 -08:00
Christoph Holtermann 64920e7c70 Small fix in expected result 2022-03-08 10:49:44 +01:00
Christoph Holtermann 07cfe9e45c Missed one redundancy 2022-03-08 10:45:17 +01:00
Christoph Holtermann 395c7a7052 Modify examples to respect previous patch 2022-03-08 10:40:12 +01:00
Christoph Holtermann 62f8acf6ae Provide the complete set of QOF enums in gnucash 2022-03-08 10:33:25 +01:00
Christoph Holtermann 06e17dfd5c 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.
2022-03-08 09:45:48 +01:00
Christoph Holtermann f44d23035e python qof examples 2022-03-06 23:52:32 +01:00
John Ralls 9ad24321b4 Remove investment-type namespaces.
Leave it to users to categorize their non-currency commodities. In the
QIF importer default non-classifiable commodities to
GNC_COMMODITY_NS_NONCURRENCY.
2022-03-01 19:58:23 -08:00
Frank H. Ellenberger c7f842c081 Bug 684507 - commodity namespace should be localized 2022-03-01 19:58:11 -08:00
John Ralls b8552a8070 Fix python transaction test_date on Ubuntu-81.04.
Python3 there is too old for fromisoformat, use direct construction
instead.
2021-09-10 17:01:38 -07:00
John Ralls fcab298245 Add test for Transaction GetDate() in python bindings.
Pursuant to Bug 798284.
2021-09-10 13:26:59 -07:00
Steven Walter 5f721614ad Remove unneeded .decode() from Invoice*.tex.templ
These values are already str's, don't decode them
2021-08-03 15:59:54 -04:00
Steven Walter 3ed6b4dab9 latex_invoices.py: write takes string not bytes
write() fails if you give it bytes, so don't encode
2021-08-01 22:17:41 -04:00
Steven Walter ba4852a9da latex_invoices.py: use default locale
Don't hardcode a locale.  Empty string means to use the user's locale
(e.g. $LANG)
2021-08-01 22:17:11 -04:00
Steven Walter ad3895fa07 latex_invoices.py: don't decode() a str
These functions all return str's not bytes.  Therefore there is no need
to decode them.
2021-08-01 22:16:33 -04:00
luz paz 95f8884892 Fix misc. typos in comments 2021-06-29 08:46:34 +02:00
Hong Xu 79d5270c9d Fix a variable name typo in Python binding gnc_pricedb_lookup_latest_before_t64
commodit -> commodity
2021-06-13 01:12:59 -07:00
John Ralls 49102c7ac2 Python Bindings: Provide a deprecated GncPriceDB.lookup_latest_before_t64.
To avoid breaking user scripts.
2021-04-23 11:56:15 +01:00
Robert Fewell 87285f945e Update gnucash_core.py with gnc-pricedb function name change 2021-04-23 11:56:15 +01:00
koldavi 506fd57989 Fix to_string_with_decimal_point_placed
>>> nominator='123456'
A digit is missing in the string returned from to_string_with_decimal_point_placed. The -1 error.
>>> point_place=2
>>> nominator[:-point_place - 1], nominator[-point_place:]
('123', '56')
2021-04-01 13:26:15 +02:00
c-holtermann d3b8a59d7e remove debug information for time conversion 2021-03-27 14:05:21 +01:00
John Ralls a11065b823 Fix fencepost error in calculating the week_num for POSIX timezone rules.
Fixes CI failure caused by US starting DST in 2021, a year in which
March began on a Monday.
2021-03-15 17:07:16 -07:00
John Ralls 66eca8aab7 Update python/gnucash_business.py to reflect rename of gncOwnerApplyPayment.
Made 3 years ago.
2021-03-14 10:48:30 -07:00
Hong Xu e0e77ca39d Add Python example export_account_totals.py
This example exports acount totals of all accounts into a CSV file.

This has been asked before: https://money.stackexchange.com/questions/111786/exporting-account-totals-in-gnucash
2020-08-01 14:47:33 -07:00
c-holtermann 22f91c407e use same order in comment as in definition of SessionOpenMode enum 2020-07-04 22:26:35 +02:00
c-holtermann 40cfb70fb7 fix SessionOpenMode explanation for SESSION_NORMAL_OPEN 2020-07-04 22:22:16 +02:00
c-holtermann 3e842a7bf6 use urllib.parse.urlparse to check for xml on python Session init 2020-06-21 16:24:53 +02:00
c-holtermann b9c6fc2876 add some unittests for python Session
test arguments, deprecated as well as new mode arguments
test creating a session with a new xml file using __init__()
and begin(). Test raising exception when opening nonexistent
file without respective mode setting.
2020-06-21 16:23:32 +02:00
c-holtermann 0434acbe10 reformat two python example scripts with black
use black python code formatter on latex_invoices.py and gncinvoice_jinja.py
2020-06-21 16:23:32 +02:00
c-holtermann 485d8a65b0 decorate Session.begin with default mode argument 2020-06-21 16:23:32 +02:00
c-holtermann 44e61f4df2 enable Session.__init__() to be provided with existing instance or book 2020-06-21 16:23:32 +02:00
c-holtermann 5833c5afcb add unittests for function_class
add tests for some existing function_class functionality.
Add tests for the keyword argument changes.
2020-06-21 16:23:32 +02:00
c-holtermann 17d606e1f8 enable keyword arguments for default_arguments_decorator
default_arguments_decorator until now only allows positional
argument defaults. This adds keyword defaults. The keywords
can be mapped to the positional arguments by optional argument
kargs_pos so interactions between keyword and positional arg
defaults can raise a TypeError. Some more information in
the docstring is included. In addition the docstring of
the wrapped function will be modified to contain information
about the defaults.
2020-06-21 16:23:32 +02:00
c-holtermann c222503f42 add method decorate_method to function_class.py
ClassFromFunctions.decorate_method() allows to provide positional
and keyword arguments for the decorator call besides the wrapped
method.
2020-06-21 16:23:32 +02:00
c-holtermann ee77b713c2 update example scripts to SessionOpenMode 2020-06-21 16:23:32 +02:00
c-holtermann b073dbc5c3 allow keyword arguments for function_class.py
allow keyword arguments for function_class methods
and functions. process_dict_convert_to_instance() is added to
mimic the behavior of the process_list_convert_to_instance()
Derived methods in gnucash_core.py like raise_backend_errors_after_call
get modified to accept being called with keyword args.
Also adds some docstrings.
2020-06-21 16:23:32 +02:00
c-holtermann 4e280b9593 adapt to use of sessionOpenMode in qof_session_begin 2020-06-20 13:40:11 +02:00