r18878 - gnucash/trunk/src/business/business-ledger - Bug#325436 creating income account for invoice doesn't restrict account type

Geert Janssens gjanssens at code.gnucash.org
Mon Mar 8 16:57:23 EST 2010


Author: gjanssens
Date: 2010-03-08 16:57:23 -0500 (Mon, 08 Mar 2010)
New Revision: 18878
Trac: http://svn.gnucash.org/trac/changeset/18878

Modified:
   gnucash/trunk/src/business/business-ledger/gncEntryLedger.c
Log:
Bug#325436 creating income account for invoice doesn't restrict account type

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedger.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedger.c	2010-03-08 18:49:08 UTC (rev 18877)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedger.c	2010-03-08 21:57:23 UTC (rev 18878)
@@ -85,6 +85,7 @@
     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 @@
         *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;



More information about the gnucash-changes mailing list