mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Find the root based off the current account and not the book. It
matters in this situation as the accounts haven't actually been added to the book yet. Fixes #414118. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15677 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
b5cff8e9b5
commit
37e232fc10
@ -567,11 +567,10 @@ equity_base_name (GNCEquityType equity_type)
|
||||
}
|
||||
|
||||
Account *
|
||||
gnc_find_or_create_equity_account (QofBook *book,
|
||||
gnc_find_or_create_equity_account (Account *root,
|
||||
GNCEquityType equity_type,
|
||||
gnc_commodity *currency)
|
||||
{
|
||||
Account *root;
|
||||
Account *parent;
|
||||
Account *account;
|
||||
gboolean name_exists;
|
||||
@ -582,11 +581,10 @@ gnc_find_or_create_equity_account (QofBook *book,
|
||||
g_return_val_if_fail (equity_type >= 0, 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 (book != NULL, NULL);
|
||||
g_return_val_if_fail (root != NULL, NULL);
|
||||
|
||||
base_name = equity_base_name (equity_type);
|
||||
|
||||
root = gnc_book_get_root_account(book);
|
||||
account = gnc_account_lookup_by_name(root, base_name);
|
||||
if (account && xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
|
||||
account = NULL;
|
||||
@ -638,7 +636,7 @@ gnc_find_or_create_equity_account (QofBook *book,
|
||||
parent = root;
|
||||
g_assert(parent);
|
||||
|
||||
account = xaccMallocAccount (book);
|
||||
account = xaccMallocAccount (gnc_account_get_book(root));
|
||||
|
||||
xaccAccountBeginEdit (account);
|
||||
|
||||
@ -673,7 +671,7 @@ gnc_account_create_opening_balance (Account *account,
|
||||
g_return_val_if_fail (account != NULL, FALSE);
|
||||
|
||||
equity_account =
|
||||
gnc_find_or_create_equity_account (book,
|
||||
gnc_find_or_create_equity_account (gnc_account_get_root(account),
|
||||
EQUITY_OPENING_BALANCE,
|
||||
xaccAccountGetCommodity (account));
|
||||
if (!equity_account)
|
||||
|
@ -161,7 +161,7 @@ typedef enum
|
||||
NUM_EQUITY_TYPES
|
||||
} GNCEquityType;
|
||||
|
||||
Account * gnc_find_or_create_equity_account (QofBook *book,
|
||||
Account * gnc_find_or_create_equity_account (Account *root,
|
||||
GNCEquityType equity_type,
|
||||
gnc_commodity *currency);
|
||||
gboolean gnc_account_create_opening_balance (Account *account,
|
||||
|
Loading…
Reference in New Issue
Block a user