Friday, February 27, 2015

Plugin dependence

The needs_plugins attribute is relatively new, and many dependencies are not yet managed automatically just because I did not yet take the time to declare them. Now I started to make more consistent usage of this attribute by declaring ot for two plugins:

  • lino.modlib.contacts needs lino.modlib.countries

  • lino_xl.lib.cal needs lino.modlib.contenttypes

This required a little optimization: in lino.core.site.Site, the load_plugins method now has a more natural behaviour: when a plugin requested by get_installed_plugins needs some other plugin, then this other plugin is inserted into the resulting INSTALLED_APPS before the plugin who needs it. Until now these automatically installed plugins went to the end of the list. Which was disturbing when using the above dependencies because the demo fixtures need to get loaded in the right order.

Side effect: This change requires a database dump & restore because the primary keys ContentType may have changed.

Another side effect : the order of some menu items in Lino Welfare changed.

Miscellaneous

I discovered that lino_welfare.modlib.debts.models.Budget has no CharField at all. which resulted in a strange behaviour: the quick search did not work. Now I added an explicit quick_search_fields so that they can now search by partner name at least:

quick_search_fields = ['partner__name']

New choicelist “Overlap groups”

I fixed #104 (Overlapping contracts are sometimes allowed), which required a change in database structure: a new database field overlap_group which points to the new choicelist isip.OverlapGroups.

Stupid Luc

Oops, I noticed that yesterdy I accidentally removed some code from lino_welfare.modlib.reception.models which was was still used. It is an outfashioned method for getting the partner field of cal.Guest to look like a client. The good way to do it would be to add a setting lino_xl.lib.cal.Plugin.partner_model and to set this to pcsw.Client in Lino Welfare.

Reception clerk cannot checkin visitors

This was due to the following lines in lino_welfare.modlib.reception.models:

MyWaitingVisitors.required.update(user_groups='coaching')
MyBusyVisitors.required.update(user_groups='coaching')
MyGoneVisitors.required.update(user_groups='coaching')

Replaced these by usage of a new plugin setting required_user_groups for lino.modlib.reception

Started a new tested document cal : Calendar plugin for Lino Welfare. Changed several details in the demo fixtures, but also found two optimizations to the module:

  • cal.EventType.__unicode__ now returns the event_label.

  • It is no longer allowed to close a meeting which lies in the future.