:date: 2016-05-27

====================
Friday, May 27, 2016
====================

Presence sheet (HTML)
=====================

Two days ago Alexa told me that she had asked their system
administrator whether he can convert a pdf file into an Excel
file. And not just some pdf file, but a :ref:`voga.presence_sheet`
generated by Lino!  So I wrote a second weasy build method:
:class:`WeasyHtmlBuildMethod
<lino.modlib.weasyprint.choicelists.WeasyHtmlBuildMethod>` and told
her to copy the output into LibreOffice or Excel. Her reaction:
"Super!"


User teams
==========

During the last days I have been meditating on one of the last
challenges for ticket :ticket:`897`: how to implement their
"departments" (Abteilungen) in :ref:`psico`.  This morning I finally
had the enlightment.  Which is also a surprisingly simple solution for
:ticket:`856`:

We just use the fact that a :attr:`username
<lino.modlib.users.models.User.username>` can be empty (in recent Lino
versions). You cannot *log in* as such a "user", but (if it has a
:attr:`profile <lino.modlib.users.models.User.profile>` and if you
have an :class:`Authority <lino.modlib.users.models.Authority>` for
it), then you can act as such a user. Users like Anne-Sopie then have
two records in the :class:`User <lino.modlib.users.models.User>`
table, one without :attr:`username
<lino.modlib.users.models.User.username>`, but linking to the same
:attr:`partner <lino.modlib.users.models.User.partner>` and having a
different :attr:`profile
<lino.modlib.users.models.User.profile>`. Yes, if their email address
changes, we need to update two fields (but not that Anne-Sophie can
have different email addresses depending on her "role"). I think this
is a perfect solution for :ticket:`856` (but we can start to use it
only after their next deployment).

In :ref:`psico` we will then introduce the notion of "teams", They
(:ref:`spz`) will have two teams: "Eupen" and "Sankt Vith".  Every
*user*, every *partner*, every *invoice* and every time-tracking
*session* (`clocking.Session`) will point to a team. The
`verbose_name` of the Team model will be changed to "Department"
(German *Abteilung*).

But that's not all. User teams will also be useful e.g. in :ref:`noi`.

The common things for all user teams is in the new
:mod:`lino_xl.lib.teams` plugin.

And then we now have :mod:`lino_tera.lib.teams` which extends
:mod:`lino_xl.lib.teams` as described above.  I started to write
functional specs in :ref:`tera.specs.teams`.

In :ref:`care` we will maybe (not yet sure, it depends on how this
project evolves) have :mod:`lino_noi.lib.teams` which injects a `team`
pointer to tickets. This would possibly be a better model for what we
currently call the `tickets.Site`. The difference between a team and a
site of a ticket would be that the team would virtually split one
database over several organizations (but still leaving common data,
e.g. users of one team can receive invitations to work on tickets for
other teams if they have the competence).


First public demo of Lino and ExtJS 6
=====================================

From today on, Hamza's work on Lino's support for ExtJS 6 is publicly
visible.  I configured one of our public demo sites so that it uses
Lino's new ExtJS 6 interface. Go and try it out yourself:

  http://team.lino-framework.org/ 

I also wrote instructions to :ref:`extjs6` how to to this on your own
site.

Of course it is not yet perfect. Because migrating a beast like Lino
from ExtJS 3 to 6 was really not easy at all.  We worked more than 200
hours on this project, most of the work was done by Hamza. Well done!


Oops
====

Oops, the first public demo above broke the other online demo sites.
There was a name clash on :ref:`lf`: the static files from ExtJS6 had
overwritten those of ExtJS3. I renamed :mod:`lino_extjs6.extjs` to
:mod:`lino_extjs6.extjs6` because I think that the app_label must be
different if you want to serve them both on a same server.  Actually
it was maybe not the app_label but the static urls for
:file:`extjs6/Ext.ux.form.DateTime.js` and
:file:`extjs6/lino.css`. Now they are both "extjs6".

Another problem: :ref:`psico` did not translate "Features" because it
did not have :mod:`lino_noi.lib.noi` installed.  But
:mod:`lino_noi.lib.noi` also acted as the customized readonly
bootstrap3 user interface. TODO: check whether one of the projects in
:ref:`noi` (probably `bs3`) can go away.