Bug#325436 creating income account for invoice doesn't restrict account type

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18878 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens
2010-03-08 21:57:23 +00:00
parent c3f2cb1189
commit 03480a5484

View File

@@ -85,6 +85,7 @@ gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
char *account_name;
ComboCell *cell = (ComboCell *) bcell;
Account *account;
GList *account_types = NULL;
/* Find the account */
account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
@@ -99,7 +100,16 @@ gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
*new = FALSE;
/* User said yes, they want to create a new account. */
account = gnc_ui_new_accounts_from_name_window (name);
account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_CREDIT);
account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_ASSET);
account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_LIABILITY);
if ( ledger->is_invoice )
account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_INCOME);
else
account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_EXPENSE);
account = gnc_ui_new_accounts_from_name_window_with_types (name, account_types);
g_list_free ( account_types );
if (!account)
return NULL;
*new = TRUE;