Wednesday, October 11, 2017

release@cpaschatelet

In the presence_sheet.weasy.html we had:

{{guest.state.button_text}}

which didn’t show anything in Lino Welfare because unlike Lino Avanti they use lino_xl.lib.cal plugin with the feedback workflow which unlike voga uses icons instead of button texts. Solution:

{{guest.state.button_text or guest.state}}

release@spz

In the early morning I updated their Lino. My main motivation was to test my changes for #2100 and #2101 on the field.

And indeed, during the meeting with Lydia I realized that there was a design flaw the production site uses different values in the Account.ref for the CommonAccounts, then Lino doesn’t find them anymore. So I did another release, with a series of quick commits.

  • New field Account.common_account, TradeType.get_object() uses this field instead of the Account.ref.

  • “You must specify a product if there is an amount.” required me to use magic art for restoring their data.

  • The “Sales base account” field on Product is back. See below.

  • UndefinedError: ‘None’ has no attribute ‘isoformat’ while parsing finan/PaymentOrder/pain_001.xml:

    File "...lino_xl/lib/finan/config/finan/PaymentOrder/pain_001.xml", line 21, in top-level template code
      <ReqdExctnDt>{{obj.execution_date.isoformat()}}</ReqdExctnDt>
    

    And because I want execution_date I changed the template to:

    {{(obj.execution_date or obj.entry_date).isoformat()}}
    

When to log the “Building… lino_x.js” message

I opened #2104 (When to log the “Building… lino_x.js” message).

The Building... lino_x.js" message is important to see in a developer console because the process takes some time and when developing you are watching at such messages. It should not be shown when running unit tests because its occurence is not (easily) predictable.

Today I realized that we would like it to be logged on a production site as well.

After some fiddling I found that the most elegant and straightforward solution is to say this:

if self.site.is_demo_site:
    logger.debug("Building %s ...", fn)
else:
    logger.info("Building %s ...", fn)

Released atelier 1.0.12

Before finding above solution, I tried to require all doctests to run with LINO_LOGLEVEL being set to WARNING. At first I thought that this can be done easily by setting in my .bash_aliases file

alias doctest='export LINO_LOGLEVEL=WARNING; python -m atelier.doctest_utf8 $*'

Then I realized that we also need to add a line to our .travis.yml files:

- export LINO_LOGLEVEL=WARNING

And finally I realized that even this is not enough and I added a new optional parameter addenv to atelier.test.make_docs_suite(). This is now being used by Developer Guide and Lino Welfare for setting the loglevel to a guaranteed value, but not to WARNING (because that caused many other tests to fail). Now it just makes sure that it is set to INFO (which is the default value, so actually it is not necessary).

Estonian VAT declaration via XML

It seems that it won’t be much of a hassle to write the XML file for and Estonian VAT declaration because everything is well documented:

Configuring sales account

The “Sales base account” field on Product (sales_account) is back.

I added a use case for it (“7010 Sales on individual therapies”) in the demo fixture of lino_book.projects.tera1.

I did layout optimizations.

The GeneralAccountBalances had order_by set to:

order_by = ['group__ref', 'ref']

I changed that to:

order_by = ['ref']

because the former silently skipped any account that had no group, which was rather disturbing. The account groups are actually for later when Lino must output annual reports.

Free Culture in Estonian

Tomorrow in Tartu is the presentation of the Estonian translation of Lawrence Lessig’s book Free Culture. Those who know this book might be amused to hear that I discovered it only now, 13 years after it was published.