r23438 - gnucash/trunk/src/engine - Bug 644044 - Lots: SQL backend loses link to Gain/Loss Txn

John Ralls jralls at code.gnucash.org
Mon Nov 25 16:11:08 EST 2013


Author: jralls
Date: 2013-11-25 16:11:08 -0500 (Mon, 25 Nov 2013)
New Revision: 23438
Trac: http://svn.gnucash.org/trac/changeset/23438

Modified:
   gnucash/trunk/src/engine/cap-gains.c
Log:
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/trunk/src/engine/cap-gains.c
===================================================================
--- gnucash/trunk/src/engine/cap-gains.c	2013-11-25 21:11:00 UTC (rev 23437)
+++ gnucash/trunk/src/engine/cap-gains.c	2013-11-25 21:11:08 UTC (rev 23438)
@@ -930,6 +930,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;
 
@@ -968,8 +969,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