:date: 2018-08-16

=========================
Thursday, August 16, 2018
=========================

About pushing too quickly to master
===================================

Oops, yesterday evening Hamza reported a test failure caused by my
changes.  I quickly answered "These failures are my mistake. I also
had them yesterday and fixed them and pushed the fix. So I was just
too quick with pushing my changes to github."  Now I ran the test
suite again on my machine and saw that there was yet another failure,
caused by the fact that I changed the verbose_name of one field from
"Sales Base account" to "Sales account".  Such failures are trivial to
fix *for me* because I caused them, but they are *not* trivial to
Hamza.



Switching from Ubuntu Desktop to xfce
=====================================

I tried to switch from Ubuntu Desktop to xfce.  Looks sympathic, but
ssh-agent doesn't seem to work. For every :cmd:`inv pd` I am getting
asked again and again::

  Enter passphrase for key '/home/luc/.ssh/id_rsa':

I just want it to work as it does in Ubuntu Desktop: pop up a window
when some program needs my passphrase for the first time.

`This thread
<https://confluence.clazzes.org/pages/viewpage.action?pageId=6848556>`__
explains how they did a similar solution (asking the password after
starting the session, which would be suboptimal for me, but maybe I
would get used to it).  made me try to install `ssh-askpass`:

  $ sudo apt install ssh-askpass

But no change.  I also read `this
<https://docs.xfce.org/xfce/xfce4-session/advanced>`__ and `this
<https://askubuntu.com/questions/412793/xubuntu-stop-gnome-keyring-daemon-from-impersonating-ssh-agent>`__,
but I don't understand them.  Yes, there are different programs to do
this, and it seems not trivial to configure them.  I don't understand
why this is such a problem.  I don't want to dive that deep into this,
at least not right now.  I switch back to Ubuntu Desktop where it
works out of the box.

Manually entering invoices - optimizations
==========================================


I had another phone meeting with Vera.  She is really doing a hard and
frustrating job: she must continue what had been done during 20 years
by Lydia who had to stop for health reasons.  Both she and me knew in
advance that it would be hard.  But yesterday morning she told me for
the first time that she had had some moments of happiness with Lino.

After the phone meeting I opened :ticket:`2490`.  Since Vera is
entering purchase invoices which are half a year old, she didn't want
Lino to suggest :func:`dd.today` as the entry date for each new
invoice.  Also for suppliers having an empty :attr:`purchase_account`
Lino was suggesting the rather arbitrary account I chose as the
:attr:`base_account <lino_xl.lib.accounting.TradeTypes.base_account>` for
purchases.

I added the notion of "Waiting account": a new choice ``waiting`` in
:attr:`lino_xl.lib.accounting.CommonAccounts` and changed
:class:`lino_xl.lib.vat.VatDocument` so that it uses this as the
default account (instead of the TradeType's :attr:`main_account
<lino_xl.lib.accounting.TradeTypes.main_account>`).

As for the entry date I used the recently discovered approach of using
a new database model :class:`lino_xl.lib.accounting.LedgerInfo` with a
OneToOneField (similar to :class:`lino_xl.lib.invoicing.SalesRule`,
see :doc:`0712`).  Before that date I would have used
:func:`dd.inject_field <lino.core.fields.inject_field>` in such a
case.
       
En passant I fixed another stupid bug that would cause frustration
once Vera would discover it: after having registered an invoice, the
insert button was disabled as long as you were in detail view.  You
had to close the detail view to re-enable the button.  The
:class:`ShowInsert <lino.core.actions.ShowInsert>` action has now
:attr:`readonly <lino.core.actions.Action.readonly>` = `True` because
otherwise it was disabled when the current row was a registered
document.


Making Lino installable using pip
=================================

Hamza, please note that noi, xl, avanti and voga have currently
version "18.04."  which causes a UserWarning "Normalizing '18.04.0' to
'18.4.0'".  The version should be without a leading 0.  And it should
be set to 18.8.0 for all projects soon (before doing the first
official PyPI release).


Lino Tera continued
===================

I had a meeting with Daniel, Harry and Gregor about the therapeutic
functions in :ref:`tera`.  Here is my new task list.

I closed the release notes for :ref:`tera_18_8_16` and started a new
page :ref:`tera.coming`.


Making Lino installable using pip
=================================

Hamza and I did research for the release process.

We would like to separate our private temporary package repository
from the book because e.g. if Hamza works on the deployment and I
change documentation and publish them, the LF site would serve my
version of the dl files instead of his version.

One idea was to use `twine <https://pypi.org/project/twine/>`__
directly on test.pypi.  Twine has an option ``--skip-existing`` which
should make it possible to overwrite our packages without changing the
version (an important feature since there are quite some issues which
appear only when installing apypi version of Lino).  But test.pypi.org
unfortunately doesn't support this option.

At this point our internet connection broke. But I continued because
the solution was so close: using `pypiserver
<https://pypi.org/project/pypiserver/>`__ I got it to work.

I updated :ref:`dev.sdist` and :ref:`user.install`.

There is still at least one problem (obviously not detected by the
test suite): :manage:`runserver` starts but does not find the static
files.  So there is only a white screen.  Hamza, I leave this for you.
See in :mod:`lino.core.urls` where it adds a pattern to MEDIA_ROOT.
And see how the MEDIA_ROOT setting is set as a child of
:attr:`lino.core.site.Site.site_dir` in :mod:`lino.core.site`.