GNOME Bugzilla – Bug 568652
add recursive cleared column
Last modified: 2018-06-29 22:16:28 UTC
I'm proposing to add a "Cleared (recursive)" column. Please find a patch attached. Reasoning: I'm keeping (single) bank account transactions in several different gnucash accounts in order to track sums on different subjects/themes/groupes. Though, I need to check the current account value against the sum provided by my bank. Therefore, I am using the cleared flag provided by gnucash. Sadly, this flag is not summed up recursively and I could not figure out how to a report displaying this sum. I think the easiest way to achieve this is by adding a new column providing the required value. This is easy to add using the "recursive" parameter of sort_by_xxx_value / gnc_ui_account_get_print_balance . I'm not sure how to update the po files, therefore I just added the appropiate translation to po/de.po .
Created attachment 126974 [details] [review] add recursive cleared column to gui v0.1
Comment on attachment 126974 [details] [review] add recursive cleared column to gui v0.1 Index: src/gnome-utils/gnc-tree-model-account.c =================================================================== --- src/gnome-utils/gnc-tree-model-account.c (Revision 17836) +++ src/gnome-utils/gnc-tree-model-account.c (Arbeitskopie) @@ -391,6 +391,7 @@ case GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT: case GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_PERIOD: case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED: + case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_RECURSIVE: case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT: case GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED: case GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT: @@ -679,6 +680,12 @@ account, FALSE, &negative); g_value_take_string (value, string); break; + case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_RECURSIVE: + g_value_init (value, G_TYPE_STRING); + string = gnc_ui_account_get_print_balance(xaccAccountGetClearedBalanceInCurrency, + account, TRUE, &negative); + g_value_take_string (value, string); + break; case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT: g_value_init (value, G_TYPE_STRING); string = gnc_ui_account_get_print_report_balance(xaccAccountGetClearedBalanceInCurrency, Index: src/gnome-utils/gnc-tree-model-account.h =================================================================== --- src/gnome-utils/gnc-tree-model-account.h (Revision 17836) +++ src/gnome-utils/gnc-tree-model-account.h (Arbeitskopie) @@ -66,6 +66,7 @@ GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT, GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_PERIOD, GNC_TREE_MODEL_ACCOUNT_COL_CLEARED, + GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_RECURSIVE, GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT, GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED, GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT, Index: src/gnome-utils/gnc-tree-view-account.c =================================================================== --- src/gnome-utils/gnc-tree-view-account.c (Revision 17836) +++ src/gnome-utils/gnc-tree-view-account.c (Arbeitskopie) @@ -358,6 +358,16 @@ } static gint +sort_by_cleared_recursive_value (GtkTreeModel *f_model, + GtkTreeIter *f_iter_a, + GtkTreeIter *f_iter_b, + gpointer user_data) +{ + return sort_by_xxx_value (xaccAccountGetClearedBalanceInCurrency, TRUE, + f_model, f_iter_a, f_iter_b, user_data); +} + +static gint sort_by_reconciled_value (GtkTreeModel *f_model, GtkTreeIter *f_iter_a, GtkTreeIter *f_iter_b, @@ -576,6 +586,12 @@ GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED, GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, sort_by_cleared_value); + gnc_tree_view_add_numeric_column(view, _("Cleared (recursive)"), "cleared_recursive", + SAMPLE_ACCOUNT_VALUE, + GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_RECURSIVE, + GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED, + GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS, + sort_by_cleared_recursive_value); priv->cleared_report_column = gnc_tree_view_add_numeric_column(view, _("Cleared (Report)"), "cleared_report", SAMPLE_ACCOUNT_VALUE, Index: po/de.po =================================================================== --- po/de.po (Revision 17836) +++ po/de.po (Arbeitskopie) @@ -9349,6 +9349,10 @@ msgid "Cleared" msgstr "Bestätigt" +#: ../src/gnome-utils/gnc-tree-view-account.c:* +msgid "Cleared (recursive)" +msgstr "Bestätigt (rekursiv)" + #: ../src/gnome-search/search-reconciled.c:228 #: ../src/gnome-utils/gnc-tree-view-account.c:584 msgid "Reconciled"
Created attachment 126975 [details] [review] add recursive cleared column to gui v0.2 Please have a look at the new msgid and their adding to po files.
This bug is similar to Bug #459493 . The main difference is that I'm proposing to add a new column when the other bug currently proposes to change column behaviour.
I think bug#459493 is "better" - the current behaviour is inconsistent to begin with. The columns should be changed to behave all identical. CLosing this bug as duplicate - please reopen if the patch from the other bug is not (yet) what you intended. Thanks for the patch in any case! *** This bug has been marked as a duplicate of 459493 ***
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=568652. Please update any external references or bookmarks.