=====================
Monday, June 15, 2015
=====================


I worked on :mod:`lino.modlib.vat` and :mod:`lino.modlib.vatless` to
make them exemplarily well documented modules.  Which raised the
question whether these two plugins should be exclusive.  My unconsious
answer until now has been "yes", but now I realized that actually
there is no reason to have them mutually exclusive.  A vat-subjected
company might also use some system of internal invoices for which
there is no concept of VAT.

So I added them *both* to :mod:`lino.projects.docs`.

Which unveiled a a name clash: the model name "Invoice" was used in
both :mod:`lino.modlib.vatless` and :mod:`lino.modlib.trading`. I might
have solved this by defining an explicit `related_query_name
<https://docs.djangoproject.com/en/5.2/ref/models/fields/#django.db.models.ForeignKey.related_query_name>`__
on each :attr:`voucher<lino.modlib.accounting.mixins.VoucherItem.voucher>`
definition, but actually it seems preferrable to have unique model
names for invoices.

So I did some model renames:

======= =============== =================
plugin  old name        new name
======= =============== =================
vat     AccountInvoice  VatAccountInvoice
vatless Invoice         AccountInvoice
sales   Invoice         VatProductInvoice
======= =============== =================

Note that the names of the default tables remain `Invoices`, and the
detail `InvoiceDetail` because there it is not necessary to use such
long and difficult to remember model names.

The requirement that 
the 
:attr:`voucher<lino.modlib.accounting.models.Voucher.voucher>` 
foreign key 
for all voucher items 
must have 
a `related_name` named `'items'`.