-
Notifications
You must be signed in to change notification settings - Fork 272
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
Error when importing entries with Decimal metadata #1607
Comments
Yes, like with #980, Fava does not really support all kinds of metadata like Decimals or Balances to be round-tripped through the import interface. A PR fixing this would be welcome :) |
I also hit this bug. Then I found the type mismatch between fava and beancount. The basic flow of fava importer is like:
So the original data type given by the importer is lost during the JSON serialization and deserialization. Usually it's not an issue as beancount tries best at handling all kinds of data. But in this Decimal metadata case, the Decimal is serialized into JSON and finally deserialized as int or float, and beancount has a strict type check. Hence the error. |
I have a CSV importer that adds
Decimal
metadata to entries, e.g.Decimal(114)
which renders tofoo: 114
. When I attempt to import a file with these transactions, an error is raised. The transactions are accepted by beancount when using the importer directly (Numbers (Decimal) are a valid metadata type), but fails when importing via fava.If I manually add a transaction through the UI, with the same metadata, it looks like fava converts it to a string, as the ledger file contains
foo: "114"
instead. I suppose numbers that come through the API are not converted any valid type.I can update my importer to use a string, which will solve it, but could fava either convert to string or Decimal in this case?
The text was updated successfully, but these errors were encountered: