beancount / ledger2beancount

Ledger to Beancount text-based converter
GNU General Public License v3.0
79 stars 15 forks source link

Transaction Code ignored #247

Closed bratekarate closed 3 years ago

bratekarate commented 3 years ago

The readme states that transaction codes will be stored as metadata. However, when converting my ledger journal I do not see such meta data. The following transaction may serve as a test:

2021/03/03=2021/03/03 * (DEBIT CARD) Supermarket XY
    Expenses:Foods:Groceries            EUR 13.57
    Assets:Bank:Checkings

Output of ledger2beancount:

1970-01-01 open Assets:Bank:Checkings
1970-01-01 open Expenses:Foods:Groceries

1970-01-01 commodity EUR

2021-03-03 * "Supermarket XY"
  Expenses:Foods:Groceries            13.57 EUR
  Assets:Bank:Checkings

The transaction code (DEBIT CARD) is not included in metadata after conversion. Should the readme be updated to not support it? Or is it me using a weird format?

Edit: On a second thought, an option would be great to just prepend the transaction code in parenthesis to the description (or even default).

tbm commented 3 years ago

You have to set code_tag in your config file.

$ cat > d.yaml
code_tag: code
$ ledger2beancount --config d.yaml d
1970-01-01 open Assets:Bank:Checkings
1970-01-01 open Expenses:Foods:Groceries

1970-01-01 commodity EUR

2021-03-03 * "Supermarket XY"
  code: "DEBIT CARD"

Is that not clear from the docs?

tbm commented 3 years ago

On a second thought, an option would be great to just prepend the transaction code in parenthesis to the description (or even default).

I don't think that's a great solution. I think moving the info to meta-data (as code_tag does) makes more sense.

tbm commented 3 years ago

https://ledger2beancount.readthedocs.io/guide/#transaction-codes

bratekarate commented 3 years ago

Well, what can I say... somehow I did not pick it up. Interestingly I have visited the section about transaction codes before, but at that time I did not understand what is meant by code_tag -- I thought it means that the ledger transaction must possess a code.

Looking back this does not make much sense, but I did not expect a yaml configuration file to be necessary to transform all transaction data to beancount format. There was a lot of configuration and mails I read about ledger, hledger and beancount recently, so I may have become somewhat documentation blind and should take a break :).

Personally I think that it would be pleasant if there was a default, but then again understand the issue of collissions with actual ledger tags. I'd like to avoid a configuration file just for the converter, but that's just my laziness. Thanks for the great converter that allows me to easily use fava to analyze my ledger journals!

tbm commented 3 years ago

Personally I think that it would be pleasant if there was a default, but then again understand the issue of collissions with actual ledger tags

When I saw your report, I was wondering about turning it on by default. I agree it would be nice, but I think there are some downsides.

The biggest one, as you say, is the potential for collisions (i.e. if someone has code metadata already). Another is that it's probably easier to turn on (define the config variable) than to turn it off (set an empty config variable?); and finally there are some similar options that I wouldn't want to turn on by default (the payer stuff) and so there would be some inconsistency between what's on and what's off by default.

So on balance I think I'll leave it off by default, even though it's not optimal.