From 1ead96dc1adbfd0dd373ff769188259ccb177f4d Mon Sep 17 00:00:00 2001 From: John Ralls Date: Mon, 25 Nov 2013 21:11:08 +0000 Subject: [PATCH] Bug 644044 - Lots: SQL backend loses link to Gain/Loss Txn Gotta edit/commit the source transaction as well as the gains txn. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23438 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/cap-gains.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/engine/cap-gains.c b/src/engine/cap-gains.c index 5401018620..e73bdfc259 100644 --- a/src/engine/cap-gains.c +++ b/src/engine/cap-gains.c @@ -930,6 +930,7 @@ xaccSplitComputeCapGains(Split *split, Account *gain_acc) { 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 @@ xaccSplitComputeCapGains(Split *split, Account *gain_acc) * 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));