diff --git a/packages/api/methods.test.ts b/packages/api/methods.test.ts index 7d14d596875ba418b2dc04c97eb34c7d88ff383c..4a3cc0900152ee58cefb10d5ea5c1ccd75cd1f51 100644 --- a/packages/api/methods.test.ts +++ b/packages/api/methods.test.ts @@ -559,8 +559,8 @@ describe('API CRUD operations', () => { const accountId = await api.createAccount({ name: 'test-account' }, 0); let newTransaction = [ - { date: '2023-11-03', imported_id: '11', amount: 100 }, - { date: '2023-11-03', imported_id: '11', amount: 100 }, + { date: '2023-11-03', imported_id: '11', amount: 100, notes: 'notes' }, + { date: '2023-11-03', imported_id: '12', amount: 100, notes: '' }, ]; const addResult = await api.addTransactions(accountId, newTransaction, { @@ -583,8 +583,9 @@ describe('API CRUD operations', () => { expect(transactions).toHaveLength(2); newTransaction = [ - { date: '2023-12-03', imported_id: '11', amount: 100 }, - { date: '2023-12-03', imported_id: '22', amount: 200 }, + { date: '2023-12-03', imported_id: '11', amount: 100, notes: 'notes' }, + { date: '2023-12-03', imported_id: '12', amount: 100, notes: 'notes' }, + { date: '2023-12-03', imported_id: '22', amount: 200, notes: '' }, ]; const reconciled = await api.importTransactions(accountId, newTransaction); @@ -600,9 +601,22 @@ describe('API CRUD operations', () => { '2023-12-31', ); expect(transactions).toEqual( - expect.arrayContaining( - newTransaction.map(trans => expect.objectContaining(trans)), - ), + expect.arrayContaining([ + expect.objectContaining({ imported_id: '22', amount: 200 }), + ]), + ); + expect(transactions).toHaveLength(1); + + // confirm imported transactions update perfomed + transactions = await api.getTransactions( + accountId, + '2023-11-01', + '2023-11-30', + ); + expect(transactions).toEqual( + expect.arrayContaining([ + expect.objectContaining({ notes: 'notes', amount: 100 }), + ]), ); expect(transactions).toHaveLength(2); diff --git a/packages/loot-core/src/server/accounts/sync.ts b/packages/loot-core/src/server/accounts/sync.ts index d8f919524f0d5df02f4576a9a76f23e7bc0076e6..39f48bcdbf357dfb52962285987b7cf18e8fc75f 100644 --- a/packages/loot-core/src/server/accounts/sync.ts +++ b/packages/loot-core/src/server/accounts/sync.ts @@ -490,7 +490,6 @@ export async function reconcileTransactions( // Update the transaction const updates = { - ...(isBankSyncAccount ? {} : { date: trans.date }), imported_id: trans.imported_id || null, payee: existing.payee || trans.payee || null, category: existing.category || trans.category || null, diff --git a/upcoming-release-notes/2648.md b/upcoming-release-notes/2648.md new file mode 100644 index 0000000000000000000000000000000000000000..6d76bca187f9e53ac455610f1028b39040472d62 --- /dev/null +++ b/upcoming-release-notes/2648.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [Wizmaster] +--- + +Don't update transaction date when importing manually \ No newline at end of file