Tuesday, December 9, 2014

Keep change records when partner gets deleted?

Working on #32. After one night of sleep I understood that we cannot simply allow cascaded delete for change records. The goal of lino.modlib.changes is to keep track of changes and to not forget about them. Even if this leads to stale generic foreign keys. OTOH we cannot forbit to delete a (watched) database object just because it has changes recorded.

So I added a new attribute Model.allow_stale_generic_foreignkey.

Model.allow_cascaded_delete

View permissions in Lino Welfare

Fixed #25 (Tabelle “Benutzer und Klienten” in Startseite nur für DSBE-Benutzer anzeigen) which was seemingly just an analysis mistake.

Changes in printout of a debts consultation budget

Continued to work on #27 (Änderungen Ausdruck Budget).

Certain strings were hard-coded German until now. Now they are internationalized:

  • Entered data - Erfasste Daten

  • Summary - Zusammenfassung

  • Changed the label of field debts.Entry.bailiff from “Debt collection agency” to “Debt collector” (Eintreiber). This field points to an external partner who either a “Debt collecting company” (Inkasso-Unternehmen) or a “Bailiff” (Gerichtsvollzieher).

  • The BailiffDebtsByBudget table is labelled “Bailiff Debts”. This must translate to “Schulden (Eintreiber)”

  • Renseignements généraux –> General information

  • Situation financière –> Financial situation

  • There are no message_extractors for .odt files. This means that when I use a translatable string in an .odt template, I must also use it somewhere else so that fab mm finds it.

  • Somebody has translated “Summary” by “Kurzbeschreibung”. It must be “Zusammenfassung”.

  • ‘Nom du médiateur de dettes’ –> ‘Name of debts mediator’

The bigger challenge in this ticket is this user request:

Tabelle “Guthaben, Schulden, Verbindlichkeit” Spalte “Gerichtsvollzieher” weg und nur die Schulden ohne bailiff. Darunter pro Schuldeneintreiber eine ebensolche Tabelle mit dem Schuldeneintreiber als Überschrift und den gleichen Kolonnen.

The overall structure of a printout is:

Financial situation - Finanzielle Situation
- General information - Allgemeine Auskünfte
- Entered data - Erfasste Daten
  (one section for every AccountGroup for which there is at least one entry
- Summary - Zusammenfassung
  - debts.ResultByBudget
  - debts.DebtsByBudget
  - debts.BailiffDebtsByBudget
  - debts.DistByBudget
- Conclusion - Schlussfolgerung

The longest section, “Entered data” is currently generated by doing one subsection for every AccountGroup for which there is at least one entry. A part of this document logic is defined in the document template (lino_welfare/modlib/debts/config/debts/Budget/Default.odt) where we have appy.pod statements like:

do section for group in self.account_groups('IEALC')

or:

do text
from table(self.entries_by_group(group))

The user request means that we no longer have simply one section per account group. For liabilities we must potentially generate a variable unmber of sections.

So we have to rethink the rather filigrane implementation of the printout and the preview of a debts.Budget.

To refresh my knowledge about accounting truths, I reviewed the docstring of lino.modlib.accounts.utils. This caused an optimization en passant: it is now possible to specify column_names on a lino.core.choicelists.ChoiceList as a simple string. Added two columns “D/C” and “Sheet” to accounts.AccountTypes.

Continued tomorrow.