Closed mohkale closed 2 years ago
Heya, thanks for the report. Note however that there is nothing wrong with hyphens in Beancount account names.
However, the first part of a Beancount account must be one of the five categories Assets, Liabilities, Income, Expenses, Equity, whereas yours is not. I hence suspect that is the reason why you're getting this error (that ledger2beancount cannot fix automatically for you), rather than anything else.
You should map your account names to valid Beancount ones using account_regex, as documented in the manual.
@zacchiro
Yes you're correct. Thank you.
The following configuration fixed it :smile:.
account_regex:
"^revenues$": "Income"
"^revenues:(.*)": "Income:$1"
You should have gotten the following note at the top of the file. Did you not get that?
; ledger2beancount conversion notes:
;
; - Non-standard root name Revenues used; please set beancount options name_*
@tbm
Well technically I'm only using ledger2beancount
to interface hledger with fava so I never actually checked the exported file directly. In fava I got the error I described at the start of this issue report, several times and looking at the exported file that message is there but I stupidly skipped past it. I only started using hledger a few days ago and beancount even less than that so this was a mixture of carelessness and the assumption that beancount was like hledger (in regards to account names not needing to be prefixed with fixed categories). Apologies for my carelessness.
No problem at all. Your bug report is actually useful because we can improve the current situation.
We set option "name_income"
automatically for some foreign-language top-level names. We can do the same for Revenue
.
I'll fix this
This should work out of the box now.
BTW, an account like Revenues
is not valid in beancount: all top-level accounts need a sub-account (e.g. Revenues:Salary
). However, ledger2beancount will rename Revenues
to Revenues:Subaccount
automatically.
Thanks for your feedback!
P.S. Since you use hledger, set hledger: true
in your ledger2beancount config.
I'm getting the following errors
Invalid account name: Revenues:Pocket-money
. When converting transactions from an account calledrevenues:pocket-money
. ledger2beancount should remove the hyphen and ideally uppercase the next letter along if possible.ledger2beancount 2.6