Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

How Lino Tera generates invoices

In Lino Tera every meeting with a therapist is basically invoiceable. Unlike in e.g. in Lino Voga they are invoiced afterwards, not in advance.

General functionality for automatically generating invoices is defined in lino_xl.lib.invoicing.

Side note: Code snippets (lines starting with >>>) in this document get tested as part of our development workflow. The following initialization snippet tells you which demo project is being used in this document.

>>> from lino import startup
>>> startup('lino_book.projects.tera1.settings.doctests')
>>> from lino.api.doctest import *

Overview

For individual and family therapies the meetings themselves (Event) are invoiceable while for group therapies every individual presence (Guest) of a meeting is invoiceable.

The invoice generator is either the therapy (for individual and family therapies) or the enrolment (for group therapies).

>>> rt.models_by_base(rt.models.invoicing.InvoiceGenerator)
[<class 'lino_tera.lib.courses.models.Course'>, <class 'lino_tera.lib.courses.models.Enrolment'>, <class 'lino_xl.lib.trading.models.InvoiceItem'>]

Lino Tera uses this functionality by extending the models Course and Enrolment so that they inherit from InvoiceGenerator.

>>> dd.plugins.periods.start_year
2015

Therapies