Installation | Topics | Beyond Lino

How to import TIM data to Lino

Prepare the Lino server

  • Start a new Lino site running Lino Così or Lino Noi, with these settings (adapt the to your local needs):

    def get_installed_plugins(self):
        yield super().get_installed_plugins()
        yield 'lino_xl.lib.tim2lino'
    
    def get_plugin_configs(self):
        yield ('tim2lino', 'languages', 'de fr')
        yield ('tim2lino', 'tim_data_path', self.site.site_dir / 'timdata')
        yield ('tim2lino', 'site_owner_id', 2334)
        yield ('tim2lino', 'ignore_journals', {'VKL'})
        yield ('vat', 'declaration_plugin', 'lino_xl.lib.bevat')
        yield ('help', 'make_help_pages', True)
        yield ('linod', 'use_channels', True)
        yield ('linod', 'daemon_user', 'tim')
        yield ('notify', 'use_push_api', True)
        yield ('periods', 'start_year', 2022)
        yield ('users', 'demo_password', "My strong password")
        yield ('weasyprint', 'margin_left', 50)
        yield ('peppol', 'supplier_id', '123e4567-4567-4654-3214-c4b232209697')
        yield ('peppol', 'onboarding_date', 20250301)
        yield super().get_plugin_configs()
    
  • Create a user account and a authorized_keys file for the TIM user:

    $ sudo adduser xxx
    $ sudo su - xxx
    $ mkdir .ssh && chmod 700 .ssh
    $ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
    

    Compare also Create a user account

Install tim2lino.bat on the TIM computer

We are going to use Windows Subsystem for Linux (WSL). The following instructions install the WSL feature. You may use the default distribution (Ubuntu), but you save some disk space by using plain Debian instead. For more information read e.g. Windows Subsystem for Linux Documentation and Basic commands for WSL.

  • Open a command-line prompt (cmd.exe) and say:

    C:\Users\joe> wsl --install -d Debian
    

    It asks you to enter a name and password for the default user account.

  • In the WSL shell you need to install the ssh and rsync packages:

    $ sudo apt-get update
    $ sudo apt-get install ssh rsync
    
  • The content of C:TIM drive is visible as something like /mnt/c/tim.

  • Generate a SSH key pair for this TIM user (see How to generate an SSH key pair) and add its public key to the authorized_keys file on the Lino server.

  • Create a file tim2lino.bat as follows:

    @echo off
    wsl --exec rsync -a --verbose --delete --delete-excluded --delete-during --times --exclude *.NTX /mnt/c/tim/data xxx@yyy.mylino.net:~/timdata
    pause
    
  • Create a shortcut to C:timtim2lino.bat on the Windows Desktop.

Configure the data import

  • Write an executable shell script initdb_tim2lino.sh as follows:

    #!/bin/bash
    set -e
    sudo systemctl stop supervisor
    rm -f tim2lino.ind
    python manage.py prep --keepmedia --traceback $*
    python manage.py checkdata -pf
    sudo systemctl restart supervisor
    
  • Manual steps to perform after each pm prep:

    • set is_outbound for sales journal

    • set send_peppol checkboxes on customers.

Install rsync on Windows

If WSL fails, here are two potential alternative approaches to install rsync on a Windows machine:

We recommend the former if possible.