Documents for a component

86 views
Skip to first unread message

yegle

unread,
Nov 29, 2015, 4:11:26 PM11/29/15
to Beancount
So I have separate asset account inside wealthfront (cash, P/L etc),
and I'm using following directory to associate documents with the
Assets:US:Wealthfront component:

$ tree stmts
stmts
└── Assets
└── US
└── Wealthfront
├── 2015-07-31.statement.pdf
├── 2015-08-31.statement.pdf
├── 2015-09-30.statement.pdf
└── 2015-10-31.statement.pdf

Two things that I noticed
1. I'd expect the links to document show on journal page of every
account under Assets:US:Wealthfront component. Instead I can only see
the links under /view/all/journal/ and
/view/all/journal/Assets:US:Wealthfront
2. I think there's a bug that unless I add a document directive, the
link to documents are not generated in the webpage. e.g.

```
; without a "document" directive, there's no link to the document on
journal web page
option "documents" "./stmts"

; omit "open" directive
```

```
; adding at least one "document" directive then the link will show
option "documents" "./stmts"
; omit "open" directive

; after adding this line the journal pages show all links to
documents, including this bogus one.
; beancount doesn't validate if the file exist.
2015-07-30 document Assets:US:Wealthfront
"stmt/Assets/US/Wealthfront/2015-07-30.statement.pdf"
```

--
yegle
http://about.me/yegle

Martin Blais

unread,
Nov 29, 2015, 4:50:51 PM11/29/15
to Beancount
On Sun, Nov 29, 2015 at 4:11 PM, yegle <cny...@gmail.com> wrote:
So I have separate asset account inside wealthfront (cash, P/L etc),
and I'm using following directory to associate documents with the
Assets:US:Wealthfront component:

$ tree stmts
stmts
└── Assets
    └── US
        └── Wealthfront
            ├── 2015-07-31.statement.pdf
            ├── 2015-08-31.statement.pdf
            ├── 2015-09-30.statement.pdf
            └── 2015-10-31.statement.pdf

Two things that I noticed
1. I'd expect the links to document show on journal page of every
account under Assets:US:Wealthfront component. Instead I can only see
the links under /view/all/journal/ and
/view/all/journal/Assets:US:Wealthfront

The problem here might be that the other views filter out the document directives. Not entirely sure, would have to check.

I'll admit the web interface needs some love and while I have some ideas for simplifying and turbocharging it (mainly integrating it with the SQL interface to make views more general), it's at the very bottom of my priority list. I'll be working on core features to make inventory booking and investment reporting better for a while.

 
2. I think there's a bug that unless I add a document directive, the
link to documents are not generated in the webpage. e.g.

```
; without a "document" directive, there's no link to the document on
journal web page
option "documents" "./stmts"

; omit "open" directive
```

```
; adding at least one "document" directive then the link will show
option "documents" "./stmts"
; omit "open" directive

; after adding this line the journal pages show all links to
documents, including this bogus one.
; beancount doesn't validate if the file exist.
2015-07-30 document Assets:US:Wealthfront
"stmt/Assets/US/Wealthfront/2015-07-30.statement.pdf"
```

Could you provide self-contained example files and specific instructions for reproducing this?
Thanks,


 

--
yegle
http://about.me/yegle

--
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/CAFL5w3Vxe0Q8vPtFKo9PufVQ4XdmyOHosh8EHfPEVSDLYnJa%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Yuchen Ying

unread,
Nov 29, 2015, 7:25:17 PM11/29/15
to Beancount

When I trying to reproduce the problem I realized that my second example (test2.bean in the gist) is actually malformed (forgot to run bean-check and didn't notice the error in bean-web console). So it's up to you if you consider this a bug.

Try this gist https://gist.github.com/yegle/cfebd29535c8c9c56528 you'll need the runme.sh script to create the stmts directory because gist doesn't support directory.

test1.bean passes bean-check and generated no document link in journal page
test2.bean failed bean-check and generate two document links in journal page

Martin Blais

unread,
Nov 29, 2015, 11:25:02 PM11/29/15
to Beancount
bean-web does display errors on the console, but only when it loads the files. Because it lazy-loads the files, you only see the error the first time you bring up a view page.  I have been meaning to plop a big red overlay with the errors on the web page too when an input file is reloaded (bean-web watches the file and reloads on-demand), it hasn't been done, I'm not very good about doing my homework when it comes to front-end JavaScript code.


Try this gist https://gist.github.com/yegle/cfebd29535c8c9c56528 you'll need the runme.sh script to create the stmts directory because gist doesn't support directory.

test1.bean passes bean-check and generated no document link in journal page

The first behavior is expected: the file isn't in an account directory. Beancount only associates documents with existing accounts, on purpose, so it avoids to create accounts you haven't declared, i.e., expects an explicit definition of accounts. This allows you to put some other files in the hierarchy, which aren't associated with accounts. If you need a doc in a non-leaf directory, declare that parent as an account in your input file.

 
test2.bean failed bean-check and generate two document links in journal page

Here are the generated errors:


/home/blais/u/Downloads/cfebd29535c8c9c56528-b54158ca9a339a0ba63ad32354afbd32750e4911/test2.bean:6:       File does not exist: "/home/blais/u/Downloads/cfebd29535c8c9c56528-b54158ca9a339a0ba63ad32354afbd32750e4911/stmts/Assets/US/BoA/Checking/2015-01-31.statement"

   2015-01-31 document Assets:US:BoA "/home/blais/u/Downloads/cfebd29535c8c9c56528-b54158ca9a339a0ba63ad32354afbd32750e4911/stmts/Assets/US/BoA/Checking/2015-01-31.statement"


/home/blais/u/Downloads/cfebd29535c8c9c56528-b54158ca9a339a0ba63ad32354afbd32750e4911/test2.bean:0:       Invalid reference to unknown account 'Assets:US:BoA'

   2015-01-31 document Assets:US:BoA "/home/blais/u/Downloads/cfebd29535c8c9c56528-b54158ca9a339a0ba63ad32354afbd32750e4911/stmts/Assets/US/BoA/2015-01-31.statement"


/home/blais/u/Downloads/cfebd29535c8c9c56528-b54158ca9a339a0ba63ad32354afbd32750e4911/test2.bean:6:       Invalid reference to unknown account 'Assets:US:BoA'

   2015-01-31 document Assets:US:BoA "/home/blais/u/Downloads/cfebd29535c8c9c56528-b54158ca9a339a0ba63ad32354afbd32750e4911/stmts/Assets/US/BoA/Checking/2015-01-31.statement"



The first is correct: the file does not exist. Beancount verifies that explicit document directives have existing files. (Note: I've been considering putting that check in a plugin so it would become optional.)

The second is correct too: the directory option triggers a search for the document in the list of all accounts seen in the input file -- including those for which there isn't an Open directive -- and creates files for them. Further down the pipeline, it barfs an error because that directive refers to an account which hasn't been declared.

Finally, the explicit directive you provided also refers to the parent account, which hasn't been declared.

This is all normal AFAICT. The question this is highlighting is whether the list of accounts to be considered when searching the directory hierarchy should include only those for which an Open directive has been seen. I'm not sure.



--
yegle
http://about.me/yegle

--
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/CAFL5w3Vxe0Q8vPtFKo9PufVQ4XdmyOHosh8EHfPEVSDLYnJa%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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.
Reply all
Reply to author
Forward
0 new messages