Friday, August 24, 2018

Improving the Developer’s Guide

I have been wondering why Abdelkader did have to ask the two questions he asked yesterday. Because theoretically they were answered in the Developer’s Guide, but he obviously didn’t find them, or if he read them before asking, they were not clear enough.

As a result of my meditations I moved three pages (The application menu, About virtual fields and Introduction to actions) from Topics to Dive into Lino and one page (The LETS tutorial) in the other direction.

Otherwise it’s clear that the pages under Dive into Lino lack concrete code examples. A newbie is probably overwhelmed with too much dry theory. That’s not a trivial issue because good code examples (1) are difficult to write and (2) should be tested.

I saw that Abdelkader is using __str__() to compute and set some values of a database object. He obviously doesn’t know about the full_clean() method. I added an introduction to this in Introduction to database models. Which caused me to write a new method lino.core.iste.Site.format_currency().

Other ideas are haunting my brain must wait until I have more time:

  • per-plugin migrators

  • country-based names for the fictive persons and companies in the contacts fictures.

A new accounting plugin: Balance sheets

I started to think about how a new plugin lino_xl.lib.sheets would work.

The following is bullshit. See Saturday, August 25, 2018.

A balance sheet (French “bilan”, German “Bilanz”) is an accounting report which summarizes the more detailed account balances of the general ledger (GeneralAccountBalances) for a given period.

Sheet fields describe the rows of a balance sheet. They are stored in the database. There are different types of fields (SheetFieldTypes): computed according to a formula, manually entered by the user, headings, sub-totals, spacers…

For example SheetFieldTypes.sum_by_ref is to sum balances of general accounts whose ref starts with a given string. Per general account we would like to see a set of rules where this account will influence the balance.

A sheet contains a sequence of sheet items. Every item has a pointer to the field and the value corresponding to that field for the observed period.

This is technically similar to VAT declarations, but the fields are stored in database and have different attributes. Should the balance sheet itself be a voucher, i.e. able to produce new ledger movements (similar to a VAT declaration)? Sounds rather strange but theoretically it makes sence. So why not.

Since the fields are stored in database, we don’t need additional per-country plugins like bevat and bevats that populate choicelists.

We cannot use inject_field() to add one database field per declaratioin field because the fields are configurable. You don’t want to migrate the database after a local configuration change.

Should we somehow use lino.modlib.summaries? With one summary row per fiscal year and computed sheet field type? No, that wouldn’t be of practical use since anyway there are items with manual values.

Not yet sure how to implement sheets that cover multiple periods and include a budget (anticipated numbers).

GitHub notifications

I noted that I have never been getting email notifications when Tonis or Hamza pushed a change to a github repository. I verified in my Settings –> Notifications, everything looks okay there. Maybe it is because of the Email preferences in my Settings ‣ Emails? I changed from “Only receive account related emails, and those I subscribe to” to “Receive all emails, except those I unsubscribe from” and hope that I will now get notified.