Friday, February 8, 2019

I checked in my work for #2826. Summary of the changes (most of them in lino.modlib.uploads):

Until now an Upload could represent:

  • an uploaded file (the original meaning)

  • just an entry representing some external document to be monitored by its author, but without any uploaded file

With #2826 we add a third possibility:

  • a “library file” (i.e. a file that has been stored on some volume using some other method than uploading).

Concretely:

  • Added a new model Volume

  • Added two fields volume and library_file to the Upload model.

  • Every voucher is now potentially an upload controller (ledger.Voucher inherits from UploadController)

  • The detail of a lino_xl.lib.vat.VatAccountInvoice now shows the UploadsByController slave table.

  • The insert_layout of UploadsByControler does not include the volume, but instead the controller (owner) decides which volume is to be used.

    IOW a new method UploadController.get_uploads_volume(). The field should be hidden or at least readonly when the owner says that there is no volume. And lino_xl.lib.vat.VatAccountInvoice should implement this method by asking the journal. New field ledger.Journal.uploads_volume.

  • The detail of a lino_xl.lib.vat.VatAccountInvoice now shows the UploadsByController slave table, but what if an application wants to use lino_xl.lib.vat without lino.modlib.uploads? e.g. Lino Tera. Quick fix : add plugins also to these applications.

TODO:

  • Limit the list of selectable files of a volume. exclude patterns, glob patterns etc.

    For example for MM we would define a volume “invoices” which shows only *.pdf files being stored in a directory named “acct/{yyyy}/EKR” where {yyyy} is the accounting year.

  • Add a field broken and a data checker that verifies whether the file still exists. This can be used both for library files and for uploaded files.

  • Maybe add a field file_modified.

  • should we define an upload area for invoices? or make it configurable per journal?

  • define a volume or two in the demo fixtures

  • write test cases and update the docs

  • remove the files plugin.

  • update the change notes.

For today I did the bare minimum because I want to have it working for Monday. The book test suite has about 18 trivial failures, but I will now commit and push the changes before everything is done in order to test it on the fly in our production site.