mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-01 21:19:16 -06:00
Bug 798100 - Equity totals calculating incorrectly
Prevents creation of non-currency opening balance accounts.
This commit is contained in:
parent
df30b6da37
commit
b66eab2583
@ -1408,7 +1408,8 @@ starting_balance_helper (Account *account, hierarchy_data *data)
|
|||||||
balance = get_final_balance (data->balance_hash, account);
|
balance = get_final_balance (data->balance_hash, account);
|
||||||
if (gnc_reverse_balance(account))
|
if (gnc_reverse_balance(account))
|
||||||
balance = gnc_numeric_neg(balance);
|
balance = gnc_numeric_neg(balance);
|
||||||
if (!gnc_numeric_zero_p (balance))
|
if (!gnc_numeric_zero_p (balance) &&
|
||||||
|
gnc_commodity_is_currency (xaccAccountGetCommodity (account)))
|
||||||
gnc_account_create_opening_balance (account, balance, gnc_time (NULL),
|
gnc_account_create_opening_balance (account, balance, gnc_time (NULL),
|
||||||
gnc_get_current_book ());
|
gnc_get_current_book ());
|
||||||
}
|
}
|
||||||
|
@ -975,6 +975,7 @@ gnc_find_or_create_equity_account (Account *root,
|
|||||||
g_return_val_if_fail (equity_type < NUM_EQUITY_TYPES, NULL);
|
g_return_val_if_fail (equity_type < NUM_EQUITY_TYPES, NULL);
|
||||||
g_return_val_if_fail (currency != NULL, NULL);
|
g_return_val_if_fail (currency != NULL, NULL);
|
||||||
g_return_val_if_fail (root != NULL, NULL);
|
g_return_val_if_fail (root != NULL, NULL);
|
||||||
|
g_return_val_if_fail (gnc_commodity_is_currency(currency), NULL);
|
||||||
|
|
||||||
use_eq_op_feature = equity_type == EQUITY_OPENING_BALANCE && gnc_using_equity_type_opening_balance_account (gnc_get_current_book ());
|
use_eq_op_feature = equity_type == EQUITY_OPENING_BALANCE && gnc_using_equity_type_opening_balance_account (gnc_get_current_book ());
|
||||||
|
|
||||||
@ -1077,16 +1078,19 @@ gnc_account_create_opening_balance (Account *account,
|
|||||||
Account *equity_account;
|
Account *equity_account;
|
||||||
Transaction *trans;
|
Transaction *trans;
|
||||||
Split *split;
|
Split *split;
|
||||||
|
gnc_commodity *commodity;
|
||||||
|
|
||||||
if (gnc_numeric_zero_p (balance))
|
if (gnc_numeric_zero_p (balance))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
g_return_val_if_fail (account != NULL, FALSE);
|
g_return_val_if_fail (account != NULL, FALSE);
|
||||||
|
commodity = xaccAccountGetCommodity (account);
|
||||||
|
g_return_val_if_fail (gnc_commodity_is_currency (commodity), FALSE);
|
||||||
|
|
||||||
equity_account =
|
equity_account =
|
||||||
gnc_find_or_create_equity_account (gnc_account_get_root(account),
|
gnc_find_or_create_equity_account (gnc_account_get_root(account),
|
||||||
EQUITY_OPENING_BALANCE,
|
EQUITY_OPENING_BALANCE,
|
||||||
xaccAccountGetCommodity (account));
|
commodity);
|
||||||
if (!equity_account)
|
if (!equity_account)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user