beancount / ledger2beancount

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

How to apply fava compatible tags? #241

Closed faaafo closed 3 years ago

faaafo commented 3 years ago

Where could I start in order to get fava[0] compatible tags (the ones starting with #)?

Using the current output I'm not able see the tags[1] in fava

Happy new year to all of you and thank you for your so useful work you did here :heart:

Input

2017/12/01 * Foo inc
    Expenses:Office                                   15.00
    Expenses:Unknown:Paypal                                              
    ; :Phone:

Current output

2017-12-01 * "Foo inc"
  Expenses:Office                        15.00
  Expenses:Unknown:Paypal
    tags: "Phone"

Expected output

2017-12-01 * "Foo inc" #Phone
  Expenses:Office                        15.00
  Expenses:Unknown:Paypal

[0] https://fava.pythonanywhere.com/example-beancount-file/help/filters/ [1] https://ledger2beancount.readthedocs.io/guide/#tags

tbm commented 3 years ago

The problem is that beancount does not have posting-level tags.

I think the correct solution (as you suggest) is to move the tags to the transaction level. I think that should be the default, and the current behaviour, which puts them into a meta-data variable, should only be chosen via config option.

tbm commented 3 years ago

Happy new year to all of you and thank you for your so useful work you did here heart

Thank you, I'm glad you find it useful!

tbm commented 3 years ago

I have a fix but after commiting the change I realized that this might actually not be the best behaviour.

The advantage of the old tags metadata is that it can fairly easily be changed to real tags later (when beancount gets support for posting-level tags). This isn't the case with this new behaviour where you can't distinguish between transaction and posting tags.

So I'll not make this the default; and I need to update the docs to clarify the pros and cons. I will do that tomorrow.

BTW, @faaafo I usually credit contributors in the docs (and good bug reports like this are contributions). If you want your name in there, let me know, otherwise I'll just write "GitHub user faafo".

tbm commented 3 years ago

@faaafo sorry for the long delay. I got busy with some other things. I still had to update the documentation for this change.

I've done that now.

If you set move_posting_tags to true, posting-levels tags will be moved to the transaction level, which is what you wanted.

I discuss the pros and cons in the manual.