Associate document with transaction

122 views
Skip to first unread message

yegle

unread,
Apr 6, 2016, 8:52:53 PM4/6/16
to Beancount
I have some transactions that I want to associate a document to, e.g. a payslip to my pay. The current model of associating document to an account is not sufficient because there's too many accounts involved in such a transaction (regular pay, federal/state tax, various other expenses).

How do you handle scenarios like this?

--

Martin Blais

unread,
Apr 7, 2016, 12:15:09 AM4/7/16
to Beancount
On Wed, Apr 6, 2016 at 8:52 PM, yegle <cny...@gmail.com> wrote:
I have some transactions that I want to associate a document to, e.g. a payslip to my pay. The current model of associating document to an account is not sufficient because there's too many accounts involved in such a transaction (regular pay, federal/state tax, various other expenses).

How do you handle scenarios like this?

The Beancount syntax doesn't specifically decide anything about this, because it doesn't have a way to render a document link for a particular transaction.

At the moment I use a "doc" field on my metadata with the filename (not the full path). I figure one day I'll might do something with those, e.g., search for the documents automatically, but I haven't needed this yet.

One thing that could be useful today is to make the Document directive accept links, and if you invoke a single transaction's linked documents, it would list the Document directive somehow.

How do you envision you'd like to use an associated document, other than looking then up manually?





Martin Blais

unread,
Apr 7, 2016, 12:21:10 AM4/7/16
to Martin Blais, Beancount
One problem with this approach is that this would only work for explicitly specified documents. In my case, and I suspect in most people's, the Document directives are automatically created by the option from its filenames. Supporting the link syntax wouldn't help.

yegle

unread,
Apr 7, 2016, 10:49:25 AM4/7/16
to Beancount

On Wed, Apr 6, 2016 at 9:14 PM, Martin Blais <bl...@furius.ca> wrote:
How do you envision you'd like to use an associated document, other than looking then up manually?

Yes that's what I want to do: check out the document while scan through the transactions. The doc is not necessarily rendered with the transaction, I just need an easy access to it.

I'm currently putting all my paycheck PDF files in documents/Income/MyEmployer, which is the most reasonable way to organize the docs. But then the docs won't show up anywhere in fava. If I put the docs in documents/Income/MyEmployer/RegularPay, then I can't access the doc when I checkout transactions of Expenses:Taxes:2016:Federal, or any other accounts involved in the transaction.

Metadata for transactions (this is not listed in the language syntax doc, update maybe?) is new to me, can you show me an example. With this I'd image I can write a plugin and add document directive for all of the accounts involved in the transaction.

Daniël Bos

unread,
Apr 7, 2016, 11:28:20 AM4/7/16
to Beancount
This could be useful for me as well. I can see two different solutions:

1. Using links, as originally proposed by Martin. In fava it's
relatively easy (and if necessary, it can be made easier) to copy the
auto-generated "document" directive, then paste it in the source file
and add a link (or tag).
(@Martin: BUG? I noticed that when I do this, both the
auto-generated "document" and the (identical) manually added
"document" show up. The auto-generated "document" should probably be
omitted)
This would look like:
2016-04-07 document Income:MyEmployer
"/path/to/document/Income/MyEmployer/Payslip-20160407.pdf"
#payslip-20160407
2016-04-07 * "MyEmployer" "Payslip" #payslip-20160407
Income:MyEmployer:RegularPay 1,234.56 MONEY
Expenses:Taxes:2016:Federal 78.90 MONEY
... etc

2. Standardizing on a meta-data solution and auto-generating the
"document" directives for all posting accounts.
This would look like:
2016-04-07 * "MyEmployer" "Payslip"
document: "/path/to/document/Income/MyEmployer/Payslip-20160407.pdf"
Income:MyEmployer:RegularPay 1,234.56 MONEY
Expenses:Taxes:2016:Federal 78.90 MONEY
... etc

and automatically generate:
2016-04-07 document Income:MyEmployer:RegularPay
"/path/to/document/Income/MyEmployer/Payslip-20160407.pdf"
2016-04-07 document Expenses:Taxes:2016:Federal
"/path/to/document/Income/MyEmployer/Payslip-20160407.pdf"
... etc

Personally I would prefer option two. It's not only more concise, it
also makes it more explicit that the document is related to the
transaction. It does require standardizing on certain meta-data
(albeit via a plugin), something which I understand Martin is hesitant
about.
> --
> You received this message because you are subscribed to the Google Groups
> "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beancount+...@googlegroups.com.
> To post to this group, send email to bean...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAFL5w3XaeJzaeXotbp_kwUb-WUL_mVtXcYwhXTLPP8iJJzNQww%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Best regards,
Daniël Bos


Your government is reading your email. Slow them down with encryption.

My public key: http://goo.gl/gms497 (4096 bit RSA, id EF2D5D91)
Fingerprint : D8D0 9FBE F075 F709 7B52 2F73 326C 2123 EF2D 5D91
Reply all
Reply to author
Forward
0 new messages