:date: 2019-08-09

======================
Friday, August 9, 2019
======================

Subtle changes in :ref:`cosi`
=============================

I continued to enter our accounting data and stumbled into the next problem: An
electricity invoice of 94,88 € introduced by a worker.  The invoice was paid by
the worker, but 35% of the total amount is paid back by the employer.  *And the
VAT on these 35% are deductible*.

.. currentmodule:: lino_xl.lib.vat

- Manually enter 94.88 in :attr:`VatProductInvoice.total_incl`. Lino fills one
  invoice item.

- Change the amount of the invoice item (:attr:`total_incl
  <InvoiceItem.total_incl>`) from 94.88 to 33.22 (94.88 * 0.35).
  Lino automatically sets :attr:`total_base
  <InvoiceItem.total_base>` to 27.68 € (33.22 / 1.20) and :attr:`total_vat
  <InvoiceItem.total_vat>` to 5.54 (33.22 - 27.68).

- Add a second line and manually set :attr:`InvoiceItem.account` to
  ``600020`` (Costs paid for workers to be paid back).

  Lino automatically fills the remaining amount (94.88 - 33.22 = 61.66) into the
  :attr:`InvoiceItem.total_incl` field and computes the other amounts of that
  line.

First issue (:ticket:`3159`): When I enter 33.22 to :attr:`total_incl
<InvoiceItem.total_incl>`, Lino automatically computes a VAT amount of 5,54 €.
But TIM had booked (and we have declared) a VAT amount of 5.53 €. I vaguely
remember some Belgian law stating that you must round down the amount of
deductible VAT.  Not sure whether TIM was right or not, but anyway Lino must
support this use case where we enter data from legacy system and want to
**manually edit the VAT amount**.

Second issue : How to instruct Lino that account ``600020`` is normally used
without VAT?
Added a new field :attr:`lino_xl.lib.accounting.Account.vat_class`.




runserver says "first seen with mtime"
======================================

https://code.djangoproject.com/ticket/30554


playing with migrations
=======================