Tuesday, May 31, 2016

Lino Voga

I worked for #953: The sums argument passed to Actor.get_sum_text (and to Widget.format_sum) now is a dict, not a list.

This API change is used (for #952) in MovementsByPartner where we now show the balance (i.e. the difference between the sums of debit and credit):

@classmethod
def get_sum_text(self, ar, sums):
    bal = sums['debit'] - sums['credit']
    return _("Balance {1} ({0} rows)").format(
        ar.get_total_count(), bal)

The same result would have been possible using the column index, but then the method would break on subclasses with different column_names.

New attribute sum_text_column because otherwise in MovementsByPartner the text of the sums row would be in the first column (which is a date) although the third column (description) is better.

WidgetFactory

Ticket #951: Hamza and I discovered that lino_extjs6.extjs6.elems had actually lots of changes. Hamza will now convert it to the new WidgetFactory system.

I discovered and fixed a first bug in the JavaScript code which had slipped through the net of our test suite: a rich TextField was not rendered correctly when tinymce was installed.

Translations

La plupart des textes du module lino_welfare.modlib.debts sont maintenant traduits en français.

‘list’ object has no attribute ‘filter’

It was not possible to select e.g. the type of a place. The server then reported:

AttributeError: 'list' object has no attribute 'filter'
in request GET /choices/countries/Places/type?_dc=1464710351811&country=BE&query=
TRACEBACK:
  ...
  File "/media/dell1tb/luc/work/lino/lino/core/dbtables.py", line 323, in add_quick_search_filter
    return qs.filter(qs.model.quick_search_filter(search_text))

This bug had been introduced a few weeks ago with the add_quick_search_filter method and had gone undiscovered since then.

Now I wrote a new functional spec about the Countries module which covers this.

I also wrote a new lino.api.doctest utility function show_choices.