mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-26 16:10:05 -05:00
Don't require the root account to have a commodity.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/remove-group@14713 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
1 parent
97f61cbea9
commit
e28c8cdc22
5 files changed
+5
-8
No files matched your search
@@ -447,8 +447,7 @@ gnc_account_end_handler(gpointer data_for_children,
|
||||
if (type != ACCT_TYPE_ROOT) {
|
||||
root = gnc_book_get_root_account(book);
|
||||
if (root == NULL) {
|
||||
gnc_commodity *com = xaccAccountGetCommodity(acc);
|
||||
root = gnc_account_create_root(book, com);
|
||||
root = gnc_account_create_root(book);
|
||||
}
|
||||
gnc_account_append_child(root, acc);
|
||||
}
|
||||
|
||||
@@ -191,8 +191,7 @@ add_account_local(sixtp_gdv2 *data, Account *act)
|
||||
if (parent == NULL) {
|
||||
root = gnc_book_get_root_account(data->book);
|
||||
if (root == NULL) {
|
||||
gnc_commodity *com = xaccAccountGetCommodity(act);
|
||||
root = gnc_account_create_root(data->book, com);
|
||||
root = gnc_account_create_root(data->book);
|
||||
/* Leave the account in the edit state. It will be committed
|
||||
* at the end of reading all the transactions. */
|
||||
xaccAccountBeginEdit(root);
|
||||
|
||||
@@ -219,15 +219,13 @@ xaccMallocAccount (QofBook *book)
|
||||
}
|
||||
|
||||
Account *
|
||||
gnc_account_create_root (QofBook *book, gnc_commodity *com)
|
||||
gnc_account_create_root (QofBook *book)
|
||||
{
|
||||
Account *root;
|
||||
|
||||
root = xaccMallocAccount(book);
|
||||
xaccAccountBeginEdit(root);
|
||||
root->type = ACCT_TYPE_ROOT;
|
||||
root->commodity = com;
|
||||
root->commodity_scu = gnc_commodity_get_fraction(com);
|
||||
xaccAccountCommitEdit(root);
|
||||
gnc_book_set_root_account(book, root);
|
||||
return root;
|
||||
|
||||
@@ -148,7 +148,7 @@ typedef enum
|
||||
Account * xaccMallocAccount (QofBook *book);
|
||||
|
||||
/** Create a new root level account. */
|
||||
Account * gnc_account_create_root (QofBook *book, gnc_commodity *com);
|
||||
Account * gnc_account_create_root (QofBook *book);
|
||||
|
||||
/** The xaccCloneAccount() does the same as xaccCloneAccountSimple(),
|
||||
* except that it also also places a pair of GUID-pointers
|
||||
|
||||
@@ -666,6 +666,7 @@ xaccAccountScrubCommodity (Account *account)
|
||||
gnc_commodity *commodity;
|
||||
|
||||
if (!account) return;
|
||||
if (xaccAccountGetType(account) == ACCT_TYPE_ROOT) return;
|
||||
|
||||
commodity = xaccAccountGetCommodity (account);
|
||||
if (commodity) return;
|
||||
|
||||
Reference in new issue
Block a user