Counting corporate beans
Beancount was already covered here almost exactly one year ago, but that review was focused on personal finances; company accounting has a different set of requirements. That article is worth reviewing, though, as the material covered there will (mostly) not be repeated here. Here, instead, the emphasis will be on what a simple business needs.
At the top of the list is the ability to import data into the system and to get it back out again. An ongoing business has a long accounting history that needs to be present going forward. Beancount keeps all of its data in a plain-text file with a well-documented format, so both import and export are relatively easy. Building on the the tools written to extract data from QuickBooks, your editor was able to write a script to import the accounting database into beancount over the course of an hour or two.
File formats
There are a couple of things worth noting about the format of the beancount file, though. A typical transaction entry looks like this:
2019-04-01 txn "Faithful reader" "Subscription, professional hacker, 12 months"
Assets:Paypal 71.97 USD
Income:SubscriptionIncome -75.60 USD
Expenses:PayPalExpense 3.63 USD
The first line provides the date and overall descriptive information; the following lines describe the various components of the transactions. These lines are called "postings" in beancount; many other systems will call them "splits" instead. By whatever name, they describe the movement of funds from one account to another; the amounts in the postings must add up to zero. This format has all of the basic information, but there are some shortcomings too.
For example, there is no way in the base format to note whether a transaction has been reconciled or not. Reconciliation is a crucial feature in an accounting system; it's how you know that your view of a specific account matches that of the financial institution on the other side. Beancount provides the ability to "assert" the balance in an account on any given date; it will then verify that the assertion is true. But that falls apart when there is a time lag between when a transaction is initiated and when it shows up in the account; outstanding checks are one example, but there are many others. Lack of proper reconciliation is a nearly fatal flaw in its own right for this particular use case.
One could of course add this feature. Beancount provides the ability to attach "metadata" to transactions, so one can add a flag that looks like this:
2019-04-01 txn "Faithful reader" "Subscription, professional hacker, 12 months"
reconciled: "no"
Assets:Paypal 71.97 USD
Income:SubscriptionIncome -75.60 USD
Expenses:PayPalExpense 3.63 USD
Then one could write the tools to support the reconciliation pass. Other missing data, such as check or transaction numbers, could be supported in the same way. It would all work, but the whole purpose was to not have to actually write the accounting system.
There's another interesting question here: how does beancount distinguish the metadata line above from the splits? It turns out that it's all done with case: account names must start with a capital letter, while metadata "keys" must be entirely lower case. Currencies ("USD" above) must be all upper case. Rules of this nature strike your editor as being somewhat fragile and unobvious; they could also restrict the project's ability to extend the transaction format in the future.
It is also worth noting that beancount explicitly ignores any lines in the file that it doesn't recognize. The apparent purpose of this feature is to allow other types of markup in the file; the ability to manage it with the Emacs Org mode is said to be especially gratifying. But this behavior can also make it easy for mistakes to pass unnoticed. Similar behavior in cron has led to security vulnerabilities in the past. Your editor would feel much better knowing that a corrupted beancount file would not escape notice.
Doing accounting
Since beancount is primarily a command-line application, there are no fancy user interfaces for dealing with accounting data. There is an Emacs mode that can help with the creation of transactions; it can perform helpful tasks like name completion. Much of the rest is expected to be done with scripts; there are a number of tools for importing transactions from various sources and a plugin mechanism to augment the processing of those transactions.
Many of the features that one would expect from an accounting system are absent from beancount. There is no ability to generate and track invoices, for example. The same can be said for bills. Indeed, beancount doesn't really have a concept of "accounts receivable" and "accounts payable" built into it. Again, one could add that with a bit of work, but that would be more work to do.
Another significant missing feature is the ability to detect and merge duplicate transactions. The failure to store transaction numbers makes things worse here. The beancount documentation talks about how, with balance assertions in place, duplicates will generate errors that can then be fixed up by hand. That may be tolerable in a personal-finance system; it will lead to significant grumpiness in a business accounting system that has to handle far more transactions.
There is a rudimentary set of reports built into beancount; they look the way one expects a balance sheet or a profit-and-loss statement to look, but there is a lack of flexibility. For example, it is pretty normal to want to restrict a report to a given period of time. The command-line tools appear to lack that capability entirely; the bean-web and fava web-based tools can only select a full year at a time. Fava can generate a basic line plot, but otherwise there is no ability to create plots at all. No pie charts for beancount users; your editor can live with that just fine, but others may feel differently. Beancount also provides a way to perform SQL-like queries on the database, which can be useful for extracting certain kinds of data.
It is worth noting that beancount is generally quick at generating reports, despite reading data from a large text file. Indeed, it is rather quicker than QuickBooks, which is faint praise but still a good thing. Still, it seems clear that the plain-text file will slow things down at some point; indeed, the beancount maintainer recently said that he's beginning to find things a bit too slow.
There is no concept of customers or vendors, so if one needs to store related information (addresses, payment terms, tax ID numbers, etc.) that information must be kept elsewhere.
One feature that isn't useful for LWN but which might be for others is the ability to track "held values" for commodities. Its primary purpose appears to be to ease the calculation of capital gains on investment transactions (investment tracking seems to be one of the main use cases for beancount's developers), but it could be put to use in any situation where one needs to track a price change between the purchase and the sale of a commodity.
Another important task is providing data to the accountant for tax filings and such. Ideally, that data would be in a form that can be read directly into their (proprietary) tax software, but that feature appears to only be available in proprietary systems. Lacking that, it would still be nice to not have to print a pile of data and hand-carry it over to get one's taxes done. Beancount has the ability to "bake" the data into a set of HTML pages that can then be placed somewhere where the accountant can see them. It is, essentially, a static site generator for accounting data.
There is, alas, no ability to generate government-mandated forms from the accounting data — a common failing in free accounting systems. Beancount also lacks the ability to print checks. Your editor is aware that you youngsters out there may never have even seen a check, but they still are necessary at times in a business setting.
Community and more
A look at the beancount Mercurial repository shows a project with a steady stream of activity. The maintainer, Martin Blais, dominates the list with far more commits than anybody else, but he is also far from the only contributor to the project. If Blais were to abruptly conclude that he'd counted enough beans for a lifetime and leave the project, there is a good chance that somebody else would step up to keep things going. That, needless to say, is a good feature for a project that a company may come to depend upon.
There is a mailing list (tragically hosted on Google Groups) as well, with a fair amount of traffic. The beancount community seems to be both engaged and helpful.
Your editor has concluded that beancount is not the solution for LWN's accounting problem. Lest the criticisms in this article seem harsh, though, it is worth pointing one thing out: this was always an attempt to use beancount for a task that is somewhat beyond what it was created for. Most of the "shortcomings" listed here are a result of that mismatch. Beancount is clearly a useful tool in many settings; for those with simpler needs it may provide all that is required, and it is easily extended for those who need to do so.
Meanwhile, the search for a QuickBooks replacement goes on, hopefully with
renewed momentum. Stay tuned... sooner or later a conclusion will be
reached and we'll be able to close the books on proprietary accounting
systems forever.
Posted Apr 12, 2019 5:41 UTC (Fri)
by tbm (subscriber, #7049)
[Link] (7 responses)
I wanted to provide some comments. FWIW, I've used ledger for 10 years, I'm in the process in migrating from ledger to beancount and I've co-written ledger2beancount.
1) "there is no way in the base format to note whether a transaction has been reconciled or not." In ledger and beancount, you'd normally use posting flags for this. You can write:
There's currently one issue (at least imho). In ledger, you have 3 states: * (reconciled), ! (problem) and nothing (unknown). In beancount, * and nothing is treated the same way, but I think they shouldn't be.
2) Regarding check and transaction numbers: metadata would definitely be the right place for this. You say "It would all work, but the whole purpose was to not have to actually write the accounting system." This is a fair point, but ledger author John Wiegley often says ledger is basically a calculator and you can build the business logic on top. beancount is similar and it actually provides a really good Python API to access the
data.
So while I agree that currently a lot of the business logic around
beancount is not there yet, I think beancount is a good basis for people to
write Python plugins to do common tasks. If you look at the external
contribution page you'll see that people have done interesting things
with beancount plugins, e.g. there's an FBAR / FinCEN 114 report generator.
3) "It is also worth noting that beancount explicitly ignores any lines
in the file that it doesn't recognize." this is true for ledger, but I
didn't think this was true in beancount. beancount (and its bean-check)
will warn if it finds invalid syntax. In general, beancount's syntax is
quite well defined. Do you have an example of something it didn't flag?
4) "Since beancount is primarily a command-line application, there are no
fancy user interfaces for dealing with accounting data." I don't think a
review of beancount makes sense without mentioning the 3rd party UI fava
(which you mention later) (note that bean-web is mostly deprecated). Fava,
while not perfect, is really useful and also allows data entry.
5) "Another significant missing feature is the ability to detect and
merge duplicate transactions" beancount has a good import mechanism
(called "ingest") which attempts to detect duplicates, but it's probably
not perfect.
6) "There is a rudimentary set of reports built into beancount" Yeah,
this area is not great. bean-report has some reports but Martin Blais
usually recommends the use of BQL (the SQL-like query interface) instead
but that has some limitations. Martin has plans to re-write the SQL-like
query tool but it's not clear when this will happen.
7) "fava web-based tools can only select a full year at a time" this is
a documentation issue. You can write something like "2019-01 to 2019-04"
in the "time" box in fava.
8) "Fava can generate a basic line plot, but otherwise there is no
ability to create plots at all. No pie charts for beancount users" I
really wish you'd take some time after your review to file some feature
requests!
9) "indeed, the beancount maintainer recently said that he's beginning
to find things a bit too slow. " Martin has some grand plans to rewrite
the beancount core in basic C++ to speed things up, but it's not clear
when/if this will happen.
10) "There is no concept of customers or vendors" yes, that's the big
problem with ledger and beancount. You need to build the business logic on
topic. But at least beancount has a really good Python API, so you could easily hook it up to some customer/vendor system.
11) "Another important task is providing data to the accountant for tax
filings and such." Martin uploads his beancount data to Google
Spreadsheets and the code is in Mercurial (e.g.
beancount/tools/sheets_upload.py). That might work for your accountants.
11) "There is, alas, no ability to generate government-mandated forms
from the accounting data" No, but I think a plugin could easily do that.
e.g. it would be easy to look up all contractors who earned $600 and more
and fill out a 1099. (I have plans to do that, fwiw, but not sure when.)
While I agree that beancount currently lacks the business logic you need, I don't think that much work would be needed to create most of it.
Posted Apr 12, 2019 6:42 UTC (Fri)
by sml (guest, #75391)
[Link] (1 responses)
> I've used ledger for 10 years, I'm in the process in migrating from ledger to beancount and I've co-written ledger2beancount.
Would you be able to elaborate on why you've decided to move from ledger to beancount?
Posted Apr 12, 2019 7:01 UTC (Fri)
by tbm (subscriber, #7049)
[Link]
While ledger works for me for many things, I find it frustrating that I've been adding all this data for many years but it's difficult to do things with it. beancount's Python API makes that much easier. (ledger has a Python API but it's too basic) Also, even though I'm mostly a command-line person, I find beancount's web UI fava really useful. It's so nice to browse your accounts, visually see how things change over time, etc.
ledger2beancount allows me to use both systems at the same time, but I intend to move to beancount fully eventually. (I also find beancount's ingest system neat for data import but haven't written the bank importers I need.)
Posted Apr 12, 2019 13:15 UTC (Fri)
by corbet (editor, #1)
[Link] (3 responses)
Posted Apr 12, 2019 14:34 UTC (Fri)
by tbm (subscriber, #7049)
[Link] (2 responses)
BTW, I ended my comment with "I don't think that much work would be needed to create most of it" but I should have added:
But I understand you want to focus on writing LWN and not on writing accounting software. It's definitely true that not enough of the needed business logic components exist today that would make it trivial to throw a few existing plugins together to meet LWN's needs.
Also, regarding 1) (reconciliations): you can put flags on postings, but you can also put flags on the whole transaction, marking the whole transaction as reconciled/checked. I mentioned posting flags specifically because that is useful if you want to go through your bank statements and mark the respective Assets: account as reconciled.
Posted Apr 12, 2019 14:58 UTC (Fri)
by mjthayer (guest, #39183)
[Link] (1 responses)
Might it be worth pointing the project maintainer at this article and seeing if he is interested in moving that way? It doesn't look from the web page like he generates any revenue from the project, so he might not be, but then again, it might also be a source of new contributors.
Posted Apr 15, 2019 7:41 UTC (Mon)
by zack (subscriber, #7062)
[Link]
tbm did point the maintainer to the article and the maintainer wrote an in-depth commentary, addressing various points raised by Jonathan,here: https://groups.google.com/forum/#!msg/beancount/Yi12cnvYI...
Posted Apr 15, 2019 7:39 UTC (Mon)
by zack (subscriber, #7062)
[Link]
Fava uses treemaps (which I find superior to pie charts, YMMV) quite extensively to show breakdowns of given accounts, see for instance https://lwn.net/Articles/752111/ from the former Beancount review article on LWN. I'm curious at why this wasn't enough for Jonathan's needs.
Posted Apr 12, 2019 15:58 UTC (Fri)
by jhoblitt (subscriber, #77733)
[Link] (3 responses)
Posted Apr 12, 2019 17:31 UTC (Fri)
by abraxis (guest, #34961)
[Link]
Posted Apr 12, 2019 17:55 UTC (Fri)
by brouhaha (subscriber, #1698)
[Link]
Posted Apr 13, 2019 3:22 UTC (Sat)
by NYKevin (subscriber, #129325)
[Link]
Then we'll finally be able to deprecate fork(), exec(), and probably all their friends except for clone().
Posted Apr 12, 2019 17:17 UTC (Fri)
by fredex (subscriber, #11727)
[Link] (1 responses)
Posted Apr 15, 2019 22:36 UTC (Mon)
by tonyblackwell (guest, #43641)
[Link]
Posted Apr 12, 2019 20:26 UTC (Fri)
by claude.bing (subscriber, #127877)
[Link]
Posted Apr 13, 2019 18:11 UTC (Sat)
by jec (subscriber, #5803)
[Link] (1 responses)
Posted Apr 14, 2019 14:13 UTC (Sun)
by corbet (editor, #1)
[Link]
Posted Apr 17, 2019 10:31 UTC (Wed)
by tonyblackwell (guest, #43641)
[Link] (2 responses)
Scripts said to be at git://git.lwn.net/qb-escape.git
$ git://git.lwn.net/qb-escape.git
Been moved?
Posted Apr 17, 2019 11:56 UTC (Wed)
by johill (subscriber, #25196)
[Link] (1 responses)
You might want to try "git clone git://git.lwn.net/..."?
Posted Apr 18, 2019 9:31 UTC (Thu)
by tonyblackwell (guest, #43641)
[Link]
Posted Apr 25, 2019 20:58 UTC (Thu)
by GoodMirek (guest, #101902)
[Link]
Posted Oct 25, 2020 20:16 UTC (Sun)
by anandgupta (guest, #142737)
[Link]
I am using beancount on windows 10 laptop's Ubuntu windows subsystem for Linux (WSL). Windows side installation of beancount asked for build tools for Visual Studio, so I did not bother with setting up beancount on windows. Beancount installation on Ubuntu WSL using pip was straight forward using 'pip install beancount'.
The business has about three and half years of data and about 25K lines in single beancount text file. The files size is about 1 MB which is quite less than equivalent gnucash file of 7 MB. Most of the data comes from two bank account and two credit card accounts.
I found writing importers quite messy so I am using hledger to convert downloaded csv data from bank and credit card websites to the beancount format. Hledger allows specifying pattern match and substitution rules using rules file to do the classification. The rules files needs to be prepared once and regularly updated for new pattern matches. This works quite well for me. Finally, I am able to keep accounts up to date on monthly basis.
For checks, I do not do any reconciliation. Basically, the entry for check transactions come from banks csv download file. So if a check was given out and nobody cashed it, it might go undetected. But my checkbook has carbon copy for those situations. Normally, people who have been given checks would come back for a re-issue if the check goes undeposited for usual check expiry time of six months. I have not run into such a situation so far.
Basically, reconciliation to me means that bank account balances in beancount and actual bank account tally with each other.
Entries for payroll, payroll taxes, business mortgage, personal miles are manual. We use a separate payroll system that is part of business software. It generates a brief reports for gross wages, fica taxes, net wages and it is easy to manually enter those in beancount file.
I use Lencerf's beancount extension in visual studio code to manually enter the transactions. It adds highlighting to the beancount file and shows you account balance of any beancount account you hover the pointer on. It also signals if any transaction is unbalanced by underlying the title line and offending split/posting.
Martin Blais mentioned beancount slowing down for files over 100K lines. And still slowdown is not bad. He mentioned loading up of the file takes like 6 to 7 seconds rather than 1 second. So timing wise it is quite acceptable.
Gitlab provides free private repositories on Gitlab.com. I use it to checkin the beancount file. visual studio code has git integrated so I can checkin and push the beancount file to the gitlab repo quite easily. I can also compare the latest file with the previous checked in file using visual studio code's git integration. Compare working tree functionality tells you exactly what has changed since last time before you check in the new changes. I think version control using git is the most important part of maintaining accounts in a text file. This way you will not accidentally lose your changes. The beancount file then can also be browsed on gitlab.com portal.
I also check in important receipts, documents, downloaded files in the documents subdirectory.
Counting corporate beans
* Assets:Paypal 71.97 USD
to indicate that you've done the manual reconciliation. It's not clear from the article how you do reconciliations exactly though.
Counting corporate beans
Advantages of beancount over ledger I personally see:
Counting corporate beans
With regard to (3), the manual says explicitly: "Any line that does not begin as a valid Beancount syntax directive (e.g. with a date) is silently ignored". So that is very much the intended behavior of the system.
Unrecognized lines
Thanks. I opened an issue to get this clarified.
Unrecognized lines
Unrecognized lines
Unrecognized lines
Counting corporate beans
(But I do understand the underlying criticism that it is not possible to create *custom* charts. Still, with filters you can go quite a long way and bookmark the resulting graphs as URLs.)
Counting corporate beans
Counting corporate beans
systemd-accounting
Counting corporate beans
Counting corporate beans
Counting corporate beans
Counting corporate beans
Counting corporate beans
Counting corporate beans
Odoo was reviewed a little while back. Compiere and forks are on the list...
Odoo
QB Escape script location?
bash: git://git.lwn.net/qb-escape.git: No such file or directory
QB Escape script location?
QB Escape script location?
Counting corporate beans
Counting corporate beans
