Bug 770364 - Sign of Value in Lots in Account window seems inconsistent

Two parts to this bug:
1. never reverse signs in the free splits list. Sign reversals don't
make sense there.

2. Sign reversal only makes sense for capital gains, not for business
transactions. So only to the sign dance for non-business lots in the
list of splits in the selected lot.
This commit is contained in:
Geert Janssens 2016-11-12 10:30:31 +01:00
parent 5b832c7f9b
commit ecb43e7d72

View File

@ -485,8 +485,12 @@ gnc_split_viewer_fill (GNCLotViewer *lv, GtkListStore *store, SplitList *split_l
{ {
SplitList *node; SplitList *node;
GtkTreeIter iter; GtkTreeIter iter;
gboolean is_business_lot = FALSE;
gnc_numeric baln = gnc_numeric_zero(); gnc_numeric baln = gnc_numeric_zero();
if (lv->selected_lot)
is_business_lot = xaccAccountIsAPARType (xaccAccountGetType (gnc_lot_get_account (lv->selected_lot)));
gtk_list_store_clear (lv->split_in_lot_store); gtk_list_store_clear (lv->split_in_lot_store);
for (node = split_list; node; node = node->next) for (node = split_list; node; node = node->next)
{ {
@ -501,8 +505,7 @@ gnc_split_viewer_fill (GNCLotViewer *lv, GtkListStore *store, SplitList *split_l
gnc_numeric amnt, valu, gains; gnc_numeric amnt, valu, gains;
/* Do not show gains splits, however do show empty business splits */ /* Do not show gains splits, however do show empty business splits */
if (!xaccAccountIsAPARType (xaccAccountGetType (xaccSplitGetAccount (split))) if (!is_business_lot && gnc_numeric_zero_p (xaccSplitGetAmount(split))) continue;
&& gnc_numeric_zero_p (xaccSplitGetAmount(split))) continue;
gtk_list_store_append(store, &iter); gtk_list_store_append(store, &iter);
@ -522,13 +525,13 @@ gnc_split_viewer_fill (GNCLotViewer *lv, GtkListStore *store, SplitList *split_l
gnc_account_print_info (lv->account, TRUE)); gnc_account_print_info (lv->account, TRUE));
gtk_list_store_set (store, &iter, SPLIT_COL_AMOUNT, amtbuff, -1); gtk_list_store_set (store, &iter, SPLIT_COL_AMOUNT, amtbuff, -1);
/* Value. Invert the sign on the first, opening entry. */ /* Value.
* For non-business accounts which are part of a lot,
* invert the sign on the first. */
currency = xaccTransGetCurrency (trans); currency = xaccTransGetCurrency (trans);
valu = xaccSplitGetValue (split); valu = xaccSplitGetValue (split);
if (node != split_list) if (lv->selected_lot && !is_business_lot && (node != split_list))
{
valu = gnc_numeric_neg (valu); valu = gnc_numeric_neg (valu);
}
xaccSPrintAmount (valbuff, valu, xaccSPrintAmount (valbuff, valu,
gnc_commodity_print_info (currency, TRUE)); gnc_commodity_print_info (currency, TRUE));
gtk_list_store_set (store, &iter, SPLIT_COL_VALUE, valbuff, -1); gtk_list_store_set (store, &iter, SPLIT_COL_VALUE, valbuff, -1);