beancount icon indicating copy to clipboard operation
beancount copied to clipboard

Don't throw an error if a Document directive is duplicated

Open blais opened this issue 6 years ago • 1 comments

Original report by Martin Blais (Bitbucket: blais, GitHub: blais).


https://github.com/beancount/fava/pull/398#issuecomment-257709139

I'm not sure it's a bug - you're assuming the user doesn't want dups, and they're telling you they do - but I think it would make sense to avoid creating multiple identical directives by default, or at least to have an option to suppress them.

You're right - it's not a bug really. As you describe it, the current behaviour is not wrong but might be surprising.

Surprising it is!

I vote for adding the following condition to the beancount-auto-document-directive-generation-code: If there is a document directive in the beancount file with the same date, account and filename, do not auto-gen a document directive.

blais avatar Apr 09 '18 03:04 blais

I was about to open a feature request before I found this issue, specifically the last paragraph.

I use the "automatic documents" feature quite extensively, but I would like this "deduplication" so that I can optionally add a link to documents.

Specifically, my use-case is invoices: I want to be able to drop in the invoice to the documents directory, but in some cases I want to add a link to it so I can connect it with the accounts receivable posting from the same date as well as to the eventual payment.

I'm able to add an additional document entry with the link without error, but then the document is doubled in the journal. The alternative would be to place documents I want to link in a parallel directory tree, but that's not ideal.

This "deduplicate for same date/account/filename" idea would work well here, and I really can't think of a circumstance where a user truly wants multiple entries for the exact same date, document, and account.

patricklucas avatar May 19 '21 13:05 patricklucas