Criação de um Servidor Local do CLVhealth-JCAFB (Turnkey Linux) (Odoo 13.0)

This project will help you create a server to host the Odoo 13 (JCAFB) solution, based on an Odoo appliance, using the VMWare Workstation infrastructure.

VM preparation

  1. Create a new Virtual Machine using the following parameters:

    • Choose the “Custom (advanced)” configuration type

    • Choose de “Virtual Machine Hardware Compatibility”: Workstation 12.x

    • Choose the gest operating system: I will install the operating system later

    • Select the Guest Operatin System: Linux (Version: Debian 10.x 64-bit)

    • Set a VM Name and a VM Location of your preference (tkl-odoo13-jcafb-vm - D:\vm\tkl-odoo13-jcafb-vm).

    • Processor Configuration:

      • Number of processors: 4
      • Number of cores per processor: 2
    • Memory for the Virtual Machine: 2048 MB

    • Choose “Use bridged networking” for the Network Type. This way you will give the operating system, direct acces to an external Ethernet network (otherwise you can use network address translation (NAT))

    • Leave the default parameters for the next three windows:

      • Select I/O Controller Types
      • Select a Disk Type
      • Select a Disk
    • Specify Disk Capacity:

      • Maximum disk size: 32.0 GB
      • Select: Split virtual disk into multiple files
    • Set the Disk File of your choice: sda\sda.vmdk

    • Finish the Virtual Machine creation.

  2. Credentials (passwords set at first boot):

    • Webmin, SSH: username root
    • PostgreSQL, Adminer: username postgres
    • Odoo Master Account: admin
  3. To access the Confconsole:

    ssh tkl-odoo13-jcafb-vm -l root
    
    confconsole
    
  4. To execute the Interactive System Initialization:

    ssh tkl-odoo13-jcafb-vm -l root
    
    turnkey-init
    
  5. Upgrade the software:

    ssh tkl-odoo13-jcafb-vm -l root
    
    apt-get update
    apt-get -y upgrade
    apt-get autoremove
    
  6. Set the odoo user password (Linux):

    1. To set the odoo user password (Linux), use the following commands (as root):

      ssh tkl-odoo13-jcafb-vm -l root
      
      passwd odoo
      
    2. Edit the file “/etc/password” (as root):

      odoo:x:110:118::/var/lib/odoo:/usr/sbin/nologin
      
      odoo:x:110:118::/var/lib/odoo:/bin/bash
      
  7. (Not Used) Set the Odoo Master Account password:

    1. Edit the file “/etc/odoo/odoo.conf” (as odoo):

      admin_passwd = $pbkdf2-sha512$25000$...
      
      ;admin_passwd = admin
      
    2. Stop and start the Odoo server, using the following commands (as root):

      ssh tkl-odoo13-jcafb-vm -l root
      
      /etc/init.d/odoo stop
      
      /etc/init.d/odoo start
      
    3. Please set a master password to secure it:

  8. Update host name, executing the following commands:

    HOSTNAME=tkl-odoo13-jcafb-vm
    echo "$HOSTNAME" > /etc/hostname
    sed -i "s|127.0.1.1 \(.*\)|127.0.1.1 $HOSTNAME|" /etc/hosts
    # /etc/init.d/hostname.sh start
    
  9. Change the timezone, executing the following command and picking out the time zone from a list:

    dpkg-reconfigure tzdata
    
    • Geographic area: America
    • Time Zone: Sao Paulo
  10. (Not Used) Set the time and date manually, executing the following command:

    date -set="STRING"
    
    • STRING: 19 JUL 2018 15:06:00
  11. Enable Connecting through SSH tunnel:

    1. Edit the file “/etc/ssh/sshd_config” (as root):

      AllowTcpForwarding no
      
      AllowTcpForwarding yes
      
    2. To stop and start the Odoo server, use the following commands (as root):

      ssh tkl-odoo13-jcafb-vm -l root
      
      service sshd restart
      
    3. (Not Used) To establish a secure tunnel from the remote computer, use one the following commands (change the local port (5432) and the remote port (33335) appropriately):

      ssh -v -L 33335:localhost:5432 root@tkl-odoo13-jcafb-vm
      
      ssh -L 33335:localhost:5432 root@tkl-odoo13-jcafb-vm
      
      ssh -v -L 33335:127.0.0.1:5432 root@tkl-odoo13-jcafb-vm
      
      ssh -L 33335:127.0.0.1:5432 root@tkl-odoo13-jcafb-vm
      

Development

  1. Notes on the installation:

    1. Installation: /usr/lib/python3/dist-packages/odoo
    2. Configuration File: /etc/odoo/odoo.conf
    3. Init file: /etc/init.d/odoo
    4. DAEMON: /usr/bin/odoo
    5. LOGFILE: /var/log/odoo/odoo-server.log
  2. To stop and start the Odoo server, use the following commands (as root):

    ssh tkl-odoo13-jcafb-vm -l root
    
    /etc/init.d/odoo stop
    
    /etc/init.d/odoo start
    
  3. Copy file “/etc/odoo/odoo.conf” into “/etc/odoo/odoo-man.conf”. Edit the file “/etc/odoo/odoo-man.conf” (as root):

    logfile = /var/log/odoo/odoo-server.log
    
    # logfile = /var/log/odoo/odoo-server.log
    logfile = False
    
  4. Setup the file “/etc/odoo/odoo-man.conf” (Group: odoo[118] Owner: odoo[112]) permissions, using the following commands (as root):

    ssh tkl-odoo13-jcafb-vm -l root
    
    chown -R odoo:odoo /etc/odoo/odoo-man.conf
    
  5. To stop and start the Odoo server, use the following commands (as root):

    ssh tkl-odoo13-jcafb-vm -l root
    
    /etc/init.d/odoo stop
    
    /etc/init.d/odoo start
    
    su odoo
    /usr/bin/odoo -c /etc/odoo/odoo-man.conf
    
  6. Install basic dependencies needed by Odoo, using the following commands (as root):

    • Extracted from LOGFILE: /var/log/odoo/odoo-server.log:

      2020-06-10 00:03:29,810 2675 WARNING ? odoo.addons.base.models.res_currency: The num2words python library is not installed, amount-to-text features won't be fully available.
      
    ssh tkl-odoo13-jcafb-vm -l root
    
    pip3 install num2words
    
  7. To create the /opt/odoo directory, use the following commands (as root):

    ssh tkl-odoo13-jcafb-vm -l root
    
    mkdir /opt/odoo
    
    chown -R odoo:odoo /opt/odoo
    
  8. To configure Git, use the following commands (as root):

    ssh tkl-odoo13-jcafb-vm -l root
    
    cd /opt/odoo
    su odoo
    
    git config --global user.email "carlos.vercelino@clvsol.com"
    git config --global user.name "Carlos Eduardo Vercelino - CLVsol"
    
    git config --global alias.lg "log --oneline --all --graph --decorate"
    
    git config --list
    
    exit
    
  9. To install erppeek (for python 3.5), use the following commands (as root):

    pip3 install erppeek
    
  10. To install xlrd 1.1.0, execute the following commands (as root):

    pip3 install xlrd
    pip3 install xlwt
    pip3 install xlutils
    
    root@tkl-odoo13-jcafb-vm .../clvsol_clvhealth_jcafb/project# pip3 install xlrd
    Requirement already satisfied: xlrd in /usr/lib/python3/dist-packages (1.1.0)
    root@tkl-odoo13-jcafb-vm .../clvsol_clvhealth_jcafb/project# pip3 install xlwt
    Collecting xlwt
      Downloading https://files.pythonhosted.org/packages/44/48/def306413b25c3d01753603b1a222a011b8621aed27cd7f89cbc27e6b0f4/xlwt-1.3.0-py2.py3-none-any.whl (99kB
        100% |████████████████████████████████| 102kB 1.3MB/s
    odoo 12.0.post20200609 requires pyldap, which is not installed.
    odoo 12.0.post20200609 requires qrcode, which is not installed.
    odoo 12.0.post20200609 requires vobject, which is not installed.
    Installing collected packages: xlwt
    Successfully installed xlwt-1.3.0
    root@tkl-odoo13-jcafb-vm .../clvsol_clvhealth_jcafb/project# pip3 install xlutils
    Collecting xlutils
      Downloading https://files.pythonhosted.org/packages/c7/55/e22ac73dbb316cabb5db28bef6c87044a95914f713a6e81b593f8a0d2f79/xlutils-2.0.0-py2.py3-none-any.whl (55kB)
        100% |████████████████████████████████| 61kB 1.0MB/s
    Requirement already satisfied: xlrd>=0.7.2 in /usr/lib/python3/dist-packages (from xlutils) (1.1.0)
    Requirement already satisfied: xlwt>=0.7.4 in /usr/local/lib/python3.7/dist-packages (from xlutils) (1.3.0)
    Installing collected packages: xlutils
    Successfully installed xlutils-2.0.0
    

    To Verify:

    • odoo 12.0.post20200609 requires pyldap, which is not installed.
    • odoo 12.0.post20200609 requires qrcode, which is not installed.
    • odoo 12.0.post20200609 requires vobject, which is not installed.
  11. (Not Used) To install odoolib (for python 3.5), use the following commands (as root):

    pip3 install odoo-client-lib
    
  12. Install basic dependencies needed by Brazilian Localization, using the following commands (as root):

    1. To install “node-less”, use the following commands (as root):

      ssh tkl-odoo13-jcafb-vm -l root
      
      apt-get install node-less
      
    2. To install “suds-py3”, use the following commands (as root):

      ssh tkl-odoo13-jcafb-vm -l root
      
      pip3 install suds-py3
      
    3. To install “erpbrasil.base”, use the following commands (as root):

      ssh tkl-odoo13-jcafb-vm -l root
      
      pip3 install erpbrasil.base
      
    4. To install “pycep-correios”, use the following commands (as root):

      ssh tkl-odoo13-jcafb-vm -l root
      
      pip3 install pycep-correios
      

Replace the Odoo installation (Odoo 13.0)

  1. Delete the ‘Turnkeylinux Example ‘ database, using the following procedure:

    1. Open a web browser and type in the Odoo URL, in my case: http://tkl-odoo13-jcafb-vm.
    2. Click on ‘Manage Databases’.
    3. Clik on ‘Delete’ (Delete the ‘Turnkeylinux Example ‘ database).
  2. To replace the Odoo installation (Odoo 13.0), use the following commands (as root):

    ssh tkl-odoo13-jcafb-vm -l root
    
    /etc/init.d/odoo stop
    
    # wget -O - https://nightly.odoo.com/odoo.key | apt-key --keyring /usr/share/keyrings/odoo.gpg add -
    echo "deb [signed-by=/usr/share/keyrings/odoo.gpg] http://nightly.odoo.com/13.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list
    
    apt-get update
    
    apt-get install odoo
    
  3. To stop and start the Odoo server, use the following commands (as root):

    ssh tkl-odoo13-jcafb-vm -l root
    
    /etc/init.d/odoo stop
    
    /etc/init.d/odoo start
    
    su odoo
    /usr/bin/odoo -c /etc/odoo/odoo-man.conf
    
  4. Configure Odoo Server timeouts

    1. Edit the files “/etc/odoo/odoo.conf” and “/etc/odoo/odoo-man.conf” (as odoo):

      limit_time_cpu = 60
      limit_time_real = 120
      
      # limit_time_cpu = 60
      limit_time_cpu = 36000
      # limit_time_real = 120
      limit_time_real = 72000
      
  5. Configure Odoo Server workers

    1. Edit the files “/etc/odoo/odoo.conf” and “/etc/odoo/odoo-man.conf” (as odoo):

  6. Configure “server_wide_modules”

    1. Edit the files “/etc/odoo/odoo.conf” and “/etc/odoo/odoo-man.conf” (as odoo):

      server_wide_modules = base,web
      
      # server_wide_modules = base,web
      server_wide_modules = None
      

Repositories Installation

  1. To install all “modules”, use the following commands (as odoo):

    ssh tkl-odoo13-jcafb-vm -l odoo
    
    cd /opt/odoo
    git clone https://github.com/OCA/l10n-brazil oca_l10n-brazil --branch 12.0
    git clone https://github.com/CLVsol/clvsol_odoo_client --branch 13.0
    git clone https://github.com/CLVsol/clvsol_clvhealth_jcafb --branch 13.0
    git clone https://github.com/CLVsol/clvsol_l10n_brazil --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_jcafb --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_l10n_br --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_l10n_br_jcafb --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_history --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_history_jcafb --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_verification --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_verification_jcafb --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_summary --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_summary_jcafb --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_export --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_export_jcafb --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_report --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_report_jcafb --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_process --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_process_jcafb --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_sync --branch 13.0
    git clone https://github.com/CLVsol/clvsol_odoo_addons_sync_jcafb --branch 12to13.0
    
  2. To create a symbolic link “odoo_client”, use the following commands (as root):

    ssh tkl-odoo13-jcafb-vm -l root
    
    cd /opt/odoo/clvsol_clvhealth_jcafb/project
    ln -s /opt/odoo/clvsol_odoo_client odoo_client
    
  3. Edit the files “/etc/odoo/odoo.conf” and “/etc/odoo/odoo-man.conf” (as odoo):

    addons_path = /usr/lib/python3/dist-packages/odoo/addons
    
    # addons_path = /usr/lib/python3/dist-packages/odoo/addons
    addons_path = /usr/lib/python3/dist-packages/odoo/addons,/opt/odoo/clvsol_odoo_addons,/opt/odoo/clvsol_odoo_addons_l10n_br,/opt/odoo/clvsol_odoo_addons_l10n_br_jcafb,/opt/odoo/clvsol_odoo_addons_jcafb,/opt/odoo/clvsol_l10n_brazil,/opt/odoo/clvsol_odoo_addons_history,/opt/odoo/clvsol_odoo_addons_history_jcafb,/opt/odoo/clvsol_odoo_addons_verification,/opt/odoo/clvsol_odoo_addons_verification_jcafb,/opt/odoo/clvsol_odoo_addons_summary,/opt/odoo/clvsol_odoo_addons_summary_jcafb,/opt/odoo/clvsol_odoo_addons_export,/opt/odoo/clvsol_odoo_addons_export_jcafb,/opt/odoo/clvsol_odoo_addons_report,/opt/odoo/clvsol_odoo_addons_report_jcafb,/opt/odoo/clvsol_odoo_addons_process,/opt/odoo/clvsol_odoo_addons_process_jcafb,/opt/odoo/clvsol_odoo_addons_sync,/opt/odoo/clvsol_odoo_addons_sync_jcafb
    

Remote access to the server

  1. To access remotly the server, use the following commands (as root):

    ssh tkl-odoo13-jcafb-vm -l root
    
    /etc/init.d/odoo stop
    
    /etc/init.d/odoo start
    
    su odoo
    /usr/bin/odoo -c /etc/odoo/odoo-man.conf
    
  2. To access remotly the server, use the following commands (as odoo) for JCAFB:

    ssh tkl-odoo13-jcafb-vm -l odoo
    
    cd /opt/odoo/clvsol_clvhealth_jcafb/project
    python3 install.py --super_user_pw "***" --admin_user_pw "***" --data_admin_user_pw "***" --db "clvhealth_jcafb"
    
    dropdb -i clvhealth_jcafb
    

Atualizar os fontes do projeto

  1. Atualizar os fontes do projeto

    ssh tkl-odoo13-jcafb-vm -l odoo
    
    /etc/init.d/odoo stop
    
    # ***** clvheatlh-jcafb-2020-aws-pro
    #
    
    cd /opt/odoo/clvsol_odoo_client
    git pull
    
    cd /opt/odoo/clvsol_clvhealth_jcafb
    git pull
    
    cd /opt/odoo/clvsol_l10n_brazil
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_jcafb
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_l10n_br
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_l10n_br_jcafb
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_history
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_history_jcafb
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_verification
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_verification_jcafb
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_summary
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_summary_jcafb
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_export
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_export_jcafb
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_report
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_report_jcafb
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_process
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_process_jcafb
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_sync
    git pull
    
    cd /opt/odoo/clvsol_odoo_addons_sync_jcafb
    git pull
    
    cd /opt/odoo
    /usr/bin/odoo -c /etc/odoo/odoo-man.conf
    

Repositories

  1. tkl-odoo13-jcafb-vm

    Name of the Turnkey Linux Server.

  2. clvsol_odoo_client (13.0)

    CLVsol Odoo Client.

  3. clvsol_clvhealth_jcafb (13.0)

    Implemantation of CLVhealth-JCAFB, the CLVsol Health Management solution for JCAFB.

  4. clvsol_l10n_brazil (13.0)

    Core da localização Brasileira do Odoo (used by CLVsol solutions) Este projeto contêm os módulos básicos da localização brasileira do Odoo, para uso exclusivo pelas soluções da CLVsol. Os módulos desse projeto deverão ser substituídos pelos módulos equivalentes do repositório OCA/l10n-brazil (13.0), quando disponíveis para a versão do Odoo utilizada.

  5. OCA/l10n-brazil (12.0)

    Este projeto contêm os principais módulos da localização brasileira do Odoo.

  6. clvsol_odoo_addons (13.0)

    CLVsol Odoo Addons.

  7. clvsol_odoo_addons_jcafb (13.0)

    CLVsol Odoo Addons - JCAFB customizations.

  8. clvsol_odoo_addons_history (13.0)

    CLVsol Odoo Addons - History

  9. clvsol_odoo_addons_history_jcafb (13.0)

    CLVsol Odoo Addons - History - JCAFB customizations

  10. clvsol_odoo_addons_l10n_br (13.0)

    CLVsol Odoo Addons - Brazilian Localization.

  11. clvsol_odoo_addons_l10n_br_jcafb (13.0)

    CLVsol Odoo Addons - Brazilian Localization - JCAFB customizations

  12. clvsol_odoo_addons_verification (13.0)

    CLVsol Odoo Addons - Verification

  13. clvsol_odoo_addons_verification_jcafb (13.0)

    CLVsol Odoo Addons - Verification - JCAFB customizations

  14. clvsol_odoo_addons_summary (13.0)

    CLVsol Odoo Addons - Summary

  15. clvsol_odoo_addons_summary_jcafb (13.0)

    CLVsol Odoo Addons - Summary - JCAFB customizations

  16. clvsol_odoo_addons_export (13.0)

    CLVsol Odoo Addons - Export

  17. clvsol_odoo_addons_export_jcafb (13.0)

    CLVsol Odoo Addons - Export - JCAFB customizations

  18. clvsol_odoo_addons_report (13.0)

    CLVsol Odoo Addons - Report

  19. clvsol_odoo_addons_report_jcafb (13.0)

    CLVsol Odoo Addons - Report - JCAFB customizations

  20. clvsol_odoo_addons_process (13.0)

    CLVsol Odoo Addons - Process

  21. clvsol_odoo_addons_process_jcafb (13.0)

    CLVsol Odoo Addons - Process - JCAFB customizations

  22. clvsol_odoo_addons_sync (13.0)

    CLVsol Odoo Addons - Sync

  23. clvsol_odoo_addons_sync_jcafb (13.0)

    CLVsol Odoo Addons - Sync - JCAFB customizations