Monday, July 26, 2021¶
I reviewed my decision of two days ago to rename
InvoiceGenerator.get_invoiceable_product()
to
InvoiceGenerator.get_invoicing_product()
because this actually is
supposed to return the product that will be invoiced.
When the InvoiceGenerator.get_invoiceable_product()
method returns None,
this generally means to not generate any invoice item.
With the nuance that it
may return None when the product is decided later by an overridden
InvoiceGenerator.get_wanted_invoice_items()
method.
The InvoiceGenerator.get_wanted_invoice_items()
method has currently three
implementations:
the standard implementation defines the default behaviour, which is that every generator produces one invoice item.
Lino Presto overrides the default behaviour to add extra invoice items (one per order item). You can configure orders where the calendar entries themselves are free (work time doesn’t count) but only these order items are being invoiced.
Lino Tera overrides it to introduce an even more customized approach. It collects the individual invoicing events per calendar entry type and only then decides which products to actually invoice. Because the price of a calendar entry in Tera depends on the partner’s price factors and on the calendar entry type.
Besides having a customized approach of grouping and pricing, Lino Tera also features a way where therapists may use a simplified cash book in which they simply type received money per calendar entry. (It might make sense to generalize this feature by moving it from tera to xl)
The InvoiceGenerator.get_wanted_invoice_items()
method is called from two places:
in
Plan.fill_plan()
to create an invoicing suggestion. The invoice and its items are created in memory just to compute the sums and then thrown away again.in
Item.create_invoice()
, i.e. to actually create the invoice for an invoicing suggestion.
Seems that I now know how to name the Tariff
model: it is an
event pass type. When a product has an event pass type,
this means that buying one unit of the product gives you the right to consume a
given number of invoicing events.
So I rename InvoiceGenerator.get_invoiceable_tariff()
to
InvoiceGenerator.get_invoicing_pass_type()
. If this returns None, Lino
simply assumes that every invoicing event generates one invoice item.
After rediscovering above things, I now turn back to Lino Noi: Something is missing for invoicing the yearly membership fees. But what?