Skip to content

A local-first personal finance app

Create transfer using child transaction instead of parent (#1581)

Joel Jeremy Marquez2b06a42ac5e8
diff --git a/packages/loot-core/src/server/accounts/transfer.ts b/packages/loot-core/src/server/accounts/transfer.ts
index 484a07d035..36e666c346 100644
--- a/packages/loot-core/src/server/accounts/transfer.ts
+++ b/packages/loot-core/src/server/accounts/transfer.ts
@@ -36,6 +36,14 @@ async function clearCategory(transaction, transferAcct) {
}
export async function addTransfer(transaction, transferredAccount) {
+ if (transaction.is_parent) {
+ // For split transactions, we should create transfers using child transactions.
+ // This is to ensure that the amounts received by the transferred account
+ // reflects the amounts in the child transactions and not the parent transaction
+ // amount which is the total amount.
+ return null;
+ }
+
let { id: fromPayee } = await db.first(
'SELECT id FROM payees WHERE transfer_acct = ?',
[transaction.account],
@@ -61,10 +69,6 @@ export async function addTransfer(transaction, transferredAccount) {
await db.updateTransaction({ id: transaction.id, payee: null });
return { id: transaction.id, payee: null };
}
-
- // The parent has the same transfer payee, so it "owns" the
- // transfer logic
- return null;
}
}
diff --git a/upcoming-release-notes/1581.md b/upcoming-release-notes/1581.md
new file mode 100644
index 0000000000..9c20da352c
--- /dev/null
+++ b/upcoming-release-notes/1581.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [joel-jeremy]
+---
+
+Fix split transaction deposits parent transaction amount to off-budget account instead of the child transaction amount