Open kosli opened 1 year ago
I see the description in the GenericImporter and how the source_desc
is being set -> https://github.com/jbms/beancount-import/blob/master/beancount_import/source/generic_importer_source.py
As this is hardcoded, it means I would need to create my own GenericImporter in case I wanna use my "raw" data for the source_desc, or if I wanna be able to use empty narration
fields, which is valid beancount syntax: https://beancount.github.io/docs/beancount_language_syntax.html#payee-narration
So maybe the generic importer should be changed to rely on a combination of payee AND narration? (Or have the source_desc set / overriden by the custom importer)
Any update/feedback on this? Thanks.
@kosli
You may raise a PR to allow importers to set source_desc
by changing this
if isinstance(posting.meta, dict):
posting.meta["source_desc"] = entry.narration
posting.meta["date"] = entry.date
to
if isinstance(posting.meta, dict):
posting.meta.setdefault("source_desc", entry.narration)
posting.meta.setdefault("date", entry.date)
So it sets narration to source_desc
only if source_desc isn't already set by the importer, and similarly for date
I have written a GenericImporter for my bank statements and I am automatically setting the
payee
andnarration
based on my "raw" data / statements.Sometimes I leave the
narration
empty, which seems to be a problem with beancount-importer. It seems that the narration field is used/copied to the source_desc field which is used for the recognition of already confirmed transactions.As my bank statements have their "raw" data which I would like for the
source_desc
matching, I tried to add them straight as metadata, but they are getting overwritten by beancount-importer.How can i define what beancount-importer uses for the
source_desc
field?