Tuesday, October 16, 2018

Keeping legacy data

In Tera they have the situation that Lydia had almost finished 2017 in Lino before she fell ill As a temporary fix they had 2017 closed by an external accountant. Now with Vera we want to start in a virgin 2018 without deleting the vouchers from 2017. IOW we just want to “deactivate” their effect on the ledger.

This is why we have force_cleared_until. Yesterday I fixed a bug where Lino ignored this setting when cleaning partner movments. Now I realize that we actually even want more: we simply don’t want to have any movments at all. Not only have them all cleared.

So I changed the behaviour and renamed it to suppress_movements_until

Making a virtual field sortable

Vera is advancing with entering accounting data into their Lino. One problem is that when a partner has many open movements in (i.e. whose cleared is False), it is difficult to find matching movements (which would clear each other if they had the same match string). Manual matching is done MovementsByPartner.

Currently it is not possible to change the match by simply editing it. This would be a nice feature, but it is not enough to simply remove “Movements.editable = False”. Because these values would get lost as soon as the voucher is unregistered. We would need to propagate any change to its “source”.

The following virtual fields of ledger.Movement now have a sortable_by: match_link voucher_link debit credit.

This revealed an API bug in lino.core.fields : until now it was not yet possible to specify sortable_by as a keyword argument in the constructor. Fixed.

And another subtle bug: it was not possible to manually reverse the sort order of a virtual field having a sortable_by which contained itself a reversed field. See example in accounting: General accounting. Fixed and covered.