Skip to content

Add transfers to merge #5001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alecbakholdin
Copy link
Contributor

Closes #5000

Initially discussed in #4899

Adds support for merging transferred transaction.

  1. If a kept transaction has no payee (including transfer) and the dropped transaction is a transfer, the dropped transaction's transfer is redirected to point to the kept transaction. Notably, this also clears out the kept transaction's category
  2. Otherwise, if the dropped transaction is a transfer and is not going to be redirected, the corresponding transfer in the other account is also dropped

Please, someone confirm if this sounds okay. This is all reversible with ctrl + z but I worry especially about the second point. To me it sounds reasonable but the alternative is we make the other transaction payee-less instead of deleting it. That seems odd as well but need advice.

@actual-github-bot actual-github-bot bot changed the title Add transfers to merge [WIP] Add transfers to merge May 16, 2025
Copy link

netlify bot commented May 16, 2025

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit bd5b938
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget/deploys/68269256daf7380009fa006a
😎 Deploy Preview https://deploy-preview-5001.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
18 9.68 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/index.js 6.57 MB 0%
static/js/de.js 120.53 kB 0%
static/js/en-GB.js 5.93 kB 0%
static/js/en.js 115.92 kB 0%
static/js/es.js 68.91 kB 0%
static/js/fr.js 124.09 kB 0%
static/js/nl.js 100.82 kB 0%
static/js/pt-BR.js 117.2 kB 0%
static/js/uk.js 121.43 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 12.94 kB 0%
static/js/workbox-window.prod.es5.js 5.64 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/ReportRouter.js 1.69 MB 0%
static/js/narrow.js 391.1 kB 0%
static/js/wide.js 113.56 kB 0%
static/js/AppliedFilters.js 10.87 kB 0%
static/js/useAccountPreviewTransactions.js 3.14 kB 0%

Copy link
Contributor

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 2.29 MB → 2.29 MB (+357 B) +0.01%
Changeset
File Δ Size
packages/loot-core/src/server/transactions/merge.ts 📈 +525 B (+25.77%) 1.99 kB → 2.5 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
kcab.worker.js 2.29 MB → 2.29 MB (+357 B) +0.01%

Smaller

No assets were smaller

Unchanged

No assets were unchanged

@alecbakholdin alecbakholdin changed the title [WIP] Add transfers to merge Add transfers to merge May 16, 2025
@youngcw
Copy link
Member

youngcw commented May 16, 2025

what would cause the second situation? Maybe you could make a demo file that shows the different merge situations so we could test more easily/consistently

@alecbakholdin
Copy link
Contributor Author

The second situation happens when the kept transaction has a payee or is a transfer already and the dropped transaction is a transfer. I'll create a test file in a bit

@cesjn
Copy link

cesjn commented May 16, 2025

My first thought is that in case 2, you should remove the payee/link, but leave the linked transaction in place (as uncategorized). This will flag the user that the transaction needs to be dealt with and avoids "silently" deleting a transaction.

My best guess as to how you get there is that an import/rule results in two sets of transactions for a single transfer (i.e. 4 total transactions). In that case, it would make sense to delete the linked one, but you may get odd behavior on which one gets deleted (i.e. if I merge the auto-created tx to a bank tx on one side, it may delete the bank tx on the other side instead of the auto-created one). So yeah, I think it would make the most sense to leave the transaction and let the user merge or delete manually.

Just my two cents :)

@alecbakholdin
Copy link
Contributor Author

The file below demonstrates situation 2.
2025-05-17-My Finances.zip

When you merge the two transactions in "account1" (shown in image below)
image
image

you get the following result:
image
image

Notice that the dropped transfer gets deleted from account2. What @cesjn is proposing is to keep that transaction in account2 like so:
image

@youngcw
Copy link
Member

youngcw commented May 17, 2025

Im thinking not deleting the other side would be better. For example if the other side is reconciled, this will still delete it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Can't merge transfers with new merge functionality
3 participants