r21574 - gnucash/trunk/src/business/business-ledger - Fix autofill on credit note ledgers.
Geert Janssens
gjanssens at code.gnucash.org
Thu Nov 17 17:24:22 EST 2011
Author: gjanssens
Date: 2011-11-17 17:24:22 -0500 (Thu, 17 Nov 2011)
New Revision: 21574
Trac: http://svn.gnucash.org/trac/changeset/21574
Modified:
gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c
gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c
Log:
Fix autofill on credit note ledgers.
Note: this introduces a subtle change in how autofill works for business
ledgers: quantities will from now on always be autofilled to positive
values. See the comment in the code for more details.
Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c 2011-11-17 22:24:13 UTC (rev 21573)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c 2011-11-17 22:24:22 UTC (rev 21574)
@@ -543,9 +543,21 @@
set_value_combo_cell (cell, account_name);
g_free (account_name);
- /* Auto-complete quantity cell */
+ /* Auto-complete quantity cell
+ * Note: we always autofill a positive quantity value. This allows us to
+ * - reuse invoice entries on credit note ledgers, meaning you can credit
+ * some invoice entry via autofill without having to manually fix the sign
+ * on the credit note.
+ * - autofill credit note entries on other credit note entries (without having
+ * to juggle sign reversals internally)
+ * - autofill credit note entries on invoice ledgers
+ *
+ * Disadvantage: invoice entries with explicitly set negative quantities will
+ * be autofilled to positive quantities in later uses. But it seems less common
+ * to me to require a negative entry again next time.
+ */
cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_QTY_CELL);
- set_value_price_cell (cell, gncEntryGetQuantity (auto_entry));
+ set_value_price_cell (cell, gnc_numeric_abs(gncEntryGetQuantity (auto_entry)));
/* Auto-complete price cell */
{
Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c 2011-11-17 22:24:13 UTC (rev 21573)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c 2011-11-17 22:24:22 UTC (rev 21574)
@@ -1274,6 +1274,9 @@
case GNCENTRY_INVOICE_VIEWER:
case GNCENTRY_BILL_VIEWER:
case GNCENTRY_EXPVOUCHER_VIEWER:
+ case GNCENTRY_CUST_CREDIT_NOTE_VIEWER:
+ case GNCENTRY_VEND_CREDIT_NOTE_VIEWER:
+ case GNCENTRY_EMPL_CREDIT_NOTE_VIEWER:
/* make this table read-only */
gnc_table_model_set_read_only (model, TRUE);
break;
More information about the gnucash-changes
mailing list