r23504 - gnucash/branches/2.4/src/engine - [23438]Bug 644044 - Lots: SQL backend loses link to Gain/Loss Txn

Geert Janssens gjanssens at code.gnucash.org
Sat Dec 7 11:08:24 EST 2013


Author: gjanssens
Date: 2013-12-07 11:08:24 -0500 (Sat, 07 Dec 2013)
New Revision: 23504
Trac: http://svn.gnucash.org/trac/changeset/23504

Modified:
   gnucash/branches/2.4/src/engine/cap-gains.c
Log:
[23438]Bug 644044 - Lots: SQL backend loses link to Gain/Loss Txn

Gotta edit/commit the source transaction as well as the gains txn.

Modified: gnucash/branches/2.4/src/engine/cap-gains.c
===================================================================
--- gnucash/branches/2.4/src/engine/cap-gains.c	2013-12-07 16:08:07 UTC (rev 23503)
+++ gnucash/branches/2.4/src/engine/cap-gains.c	2013-12-07 16:08:24 UTC (rev 23504)
@@ -926,6 +926,7 @@
         {
             Account *lot_acc = gnc_lot_get_account(lot);
             QofBook *book = qof_instance_get_book(lot_acc);
+            Transaction *base_txn = xaccSplitGetParent (split);
 
             new_gain_split = TRUE;
 
@@ -964,8 +965,11 @@
              * that this is the gains transaction that corresponds
              * to the gains source.
              */
+            xaccTransBeginEdit (base_txn);
             kvp_frame_set_guid (split->inst.kvp_data, "gains-split",
                                 xaccSplitGetGUID (lot_split));
+            qof_instance_set_dirty (QOF_INSTANCE (split));
+            xaccTransCommitEdit (base_txn);
             kvp_frame_set_guid (lot_split->inst.kvp_data, "gains-source",
                                 xaccSplitGetGUID (split));
 



More information about the gnucash-changes mailing list