johannesgerer / buchhaltung

Smart tools for the ledger universe
http://johannesgerer.com/buchhaltung
MIT License
97 stars 8 forks source link

buchhaltung update duplicate transaction #17

Closed varac closed 6 years ago

varac commented 7 years ago

Hi, after using buchhaltung for a few weeks now I came across one credit card payment that results in 4 transactions like this:

» hledger reg amt:262.78
2017/06/29 ABC BANK  ... USA ... USD 290,00 K..  Aktiva:ABC:Kreditkarte                                   -262,78 EUR   -262,78 EUR
                                                                   TODO:Positive                                             262,78 EUR             0
2017/07/27 ABC Bank eG  Kreditkarte Abrechnung         Aktiva:ABC:Giro                                          -262,78 EUR   -262,78 EUR
                                                                   TODO:Positive                                             262,78 EUR             0
2017/07/28 ABC Bank  Abrechnung vom 18/07/17 Kreditkarte            Aktiva:ABC:Kreditkarte                                   -262,78 EUR   -262,78 EUR
                                                                   TODO:Positive                                             262,78 EUR             0
2017/07/28 ABC Bank  Abrechnung vom 18/07/17 Kreditkarte            Aktiva:ABC:Kreditkarte                                    262,78 EUR    262,78 EUR
                                                                   TODO:Negative                                            -262,78 EUR             0

When I remove these transactions from the buchhaltung import file, and run buchhaltung update again, they appear in exact the same manner.

How could I supply more details in a safe way ? GPG/Mail ?

varac commented 7 years ago

Instead of debugging why exactly this transaction is duplicated, what about a flag that you can add to the imported transaction that marks it ignored ? In this case, I could just mark two transactions as to be ignored, and buchhaltung update will stop adding these over and over again.

johannesgerer commented 7 years ago

Yes, please contact me via email which you find in my profile.

Generally, though, I would propose the following alternatives to selectively ignoring/accepting transactions from your credit card statement:

  1. If the transactions have no net impact on the credit card balance, then their opposite postings also will net to zero. Thus you can match these transaction into an Ignored account which will also net to zero and not be shown in your balance. This even enables the bayesian classifier to suggest to put them into Ignored in the future.

  2. If they have a net effect that produces the correct credit card balance, then you should really not ignore them.

  3. If they have a net effect that produces the wrong credit card balance, please come back with more details.

varac commented 7 years ago

@johannesgerer Thx for the hint, for now I'm happy with Option 1. At least the balance is fine now. Still a little annoying that these 2 dupes show up in the list of transctions in the credit card account, but that's ok. I'll post here if I encounted dupes again.

varac commented 6 years ago

So now I realised that the source of the problem is whenever you transfer money from one bank account to another (called "Umbuchung" in germany). I can reproduce this issue 100% by doing such a bank transaction which leads to one ledger transaction per account, which will result in one duplicate.

I'm currently using a sed script which removes the duplicate as a workaround but this issue should get fixed properly imo. Happy to help with any debug information, although I'd prefer to submit sensitive transaction details using email encryption.

johannesgerer commented 6 years ago

Glad that you spotted this. This"problem" has a simple solution.

Instead of having to transactions from account A to B, you use a "transfer" account in the middle:

10€ from A to T 10€ from T to B

What I like about this is its transparency:

If a transfer takes a few days you will are able to reproduce the reported balances of A and B, whereas T would show a non-zero balance indicating an ongoing transfer.

On February 12, 2018 9:24:30 AM GMT+00:00, Varac notifications@github.com wrote:

So now I realised that the source of the problem is whenever you transfer money from one bank account to another (called "Umbuchung" in germany). I can reproduce this issue 100% by doing such a bank transaction which leads to one ledger transaction per account, which will result in one duplicate.

I'm currently using a sed script which removes the duplicate as a workaround but this issue should get fixed properly imo. Happy to help with any debug information, although I'd prefer to submit sensitive transaction details using email encryption.

-- You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub: https://github.com/johannesgerer/buchhaltung/issues/17#issuecomment-364867865

varac commented 6 years ago

@johannesgerer Thx can try that. What kind of account would T be in hledgers top-level namescopes (assets, liabilities, expenses and income), or would it be a special account besides those ?

Don't you think buchhaltung should cover these duplicates properly so users do not have to implement this intermediate transaction ?

johannesgerer commented 6 years ago

The account clearly belongs to your assets.

The example I gave, shows that using this account is actually the right and more explicit thing to do (esepcially in the case of time delay etc).

In the end you DO get both transactions from you bank or on your statements and even in real life you need to make sure that they are identical.

As always, I am open to suggestions.

On February 12, 2018 1:12:18 PM GMT+00:00, Varac notifications@github.com wrote:

@johannesgerer Thx can try that. What kind of account would T be in hledgers top-level namescopes (assets, liabilities, expenses and income), or would it be a special account besides those ?

Don't you think buchhaltung should cover these duplicates properly so users do not have to implement this intermediate transaction ?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/johannesgerer/buchhaltung/issues/17#issuecomment-364918534

johannesgerer commented 6 years ago

See also https://www.buchfuehren-lernen.de/kurs/doppelte-buchfuehrung/die-bedeutung-der-interimskonten/geldtransit.html

On February 12, 2018 1:12:18 PM GMT+00:00, Varac notifications@github.com wrote:

@johannesgerer Thx can try that. What kind of account would T be in hledgers top-level namescopes (assets, liabilities, expenses and income), or would it be a special account besides those ?

Don't you think buchhaltung should cover these duplicates properly so users do not have to implement this intermediate transaction ?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/johannesgerer/buchhaltung/issues/17#issuecomment-364918534