A local-first personal finance app
Fix scheduled transfers not linking when payee account is imported first (#6025)
Matiss Janis Aboltins1a845583efd8
diff --git a/packages/loot-core/src/server/transactions/transfer.ts b/packages/loot-core/src/server/transactions/transfer.tsindex 954bfdad87..4979f69093 100644--- a/packages/loot-core/src/server/transactions/transfer.ts+++ b/packages/loot-core/src/server/transactions/transfer.ts@@ -68,14 +68,21 @@ export async function addTransfer(transaction, transferredAccount) {schedule: transaction.schedule,cleared: false,};- const { notes, cleared } = await runRules(transferTransaction);+ const { notes, cleared, schedule } = await runRules(transferTransaction);+ const matchedSchedule = schedule ?? transaction.schedule;+const id = await db.insertTransaction({...transferTransaction,notes,cleared,+ schedule: matchedSchedule,});- await db.updateTransaction({ id: transaction.id, transfer_id: id });+ await db.updateTransaction({+ id: transaction.id,+ transfer_id: id,+ ...(matchedSchedule ? { schedule: matchedSchedule } : {}),+ });const categoryCleared = await clearCategory(transaction, transferredAccount);return {diff --git a/upcoming-release-notes/6025.md b/upcoming-release-notes/6025.mdnew file mode 100644index 0000000000..c853d5440c--- /dev/null+++ b/upcoming-release-notes/6025.md@@ -0,0 +1,7 @@+---+category: Bugfix+authors: [MatissJanis]+---++Fix scheduled transfers not linking when payee account is imported first+