-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
How to deduplicate 2 transactions that are really one transfer from one bank account to another #51
Comments
Thanks for raising this @lestephane, I think this is mostly a gap in our documentation at the moment. The solution is to change your rules files to introduce an intermediate account as soon as you start importing statements for both accounts. I use In your example Any posting to You can just use I typically use the sorted account names as the subaccount (Python code sample): "Assets:Transfers:" + "".join(sorted(["Bank2", "Bank1"])) This approach is based on what is described in Full-fledged hledger: |
Thanks for the explanation and the full-fledged hledger page (which somehow passed me by), I want the directionality of the transfer to be apparent without digging in the journal, Example:
I think this issue can be closed for now, as the problem seems well known, has a solution, |
I've updated the FAQ with this solution: |
in
bank1.journal
, imported from bank1.csvin
bank2.journal
, imported from bank2.csvWhen I then run
hledger-ui
, I get an balance assertion error, because it sees two debits of EUR-11,22, not a single one, within the same day. I added the transaction code to try to make hledger-ui see one unique transaction, to no avail. It seems to work that way by design, which makes it difficult to handle transfers between my accounts in the hledger-flow world.I tried to use virtual postings for bank2, to no avail.
What is the correct way to do this in the hledger world, and most importantly in the hledger-flow world?
Approach 1: Remove problematic line in the bank2
preprocess
scriptProbably the simplest approach, the bank2
preprocess
script could have agrep -v <txid we want to ignore>
, so that the transaction ends up in only one journal.Problem: In the bank subdirectory, there is a CSV line for the transaction in question in
1-in
, but no corresponding transaction in3-journal
. It feels like we're rewriting history.Additionally, we now lose some information, such as when the day on which the money leaves bank1 is different from the day on which the money arrives in bank2.
Approach 2: Comment out the problematic journal entry using a bank2
construct
scriptProblem: You need to switch to using a
construct
file, you lose the ability to use a.rules
file.My current approach is Approach 1, since in my case bank2 uses a
.rules
file.Have you encountered this situation, and how did you resolve it?
The text was updated successfully, but these errors were encountered: