/odoo

Primary LanguagePython

TOC

Overview of scalable odoo

OS installation and configuration

The following instructions are based on Ubuntu 18.04 LTS.

time zone and ntp

dpkg-reconfigure tzdata
apt-get install ntp

install

sudo apt update
sudo apt install nginx

configuration (/etc/nginx/sites-available/default)

if ($http_x_forwarded_proto = "http") {
    return 301 https://$host$request_uri; 
}

...

location / {    
    proxy_set_header   X-Forwarded-For $remote_addr;
    proxy_set_header   Host $http_host;
    proxy_pass         "http://127.0.0.1:8069";
}

# map /var/www/dehydrated/
location /.well-known/acme-challenge/ {
    alias /var/www/dehydrated/;
}
...

security see here

sudo add-apt-repository ppa:gslin/dehydrated-lite
sudo apt update
sudo apt install dehydrated-lite

configuration

sudo mkdir /etc/dehydrated
sudo touch /etc/dehydrated/config
sudo touch /etc/dehydrated/domains.txt

/etc/dehydrated/config

KEYSIZE=2048

/etc/dehydrated/domains.txt

${domain_name}
  • multiple domains in one certificat.
${domain_name1} ${domain_name2}

make dir for sign/renew the domain certificates

  • chmod if required
mkdir -p /var/www/dehydrated

create ssl certificates

  1. accept these terms of service at first time only
sudo dehydrated --register --accept-terms
  1. Sign/renew non-existent/changed/expiring certificates with challenge (http-01/dns-01)
  • http-01
sudo dehydrated -c
  • dns-01 if wildcard domain, e.g. *.hoogahome.tw
export PROVIDER=godaddy
export GD_KEY="your-godaddy-api-key-here"
export GD_SECRET="your-godaddy-api-secret-here"
echo "hoogahome.com *.hoogahome.com" > domains.txt
./dehydrated -c --challenge dns-01 --hook ./godaddy.sh

# copy/past TOKEN into DNS TXT record with "_acme-challenge" subdomain in DNS management console
# e.g. waiting for $TOKEN in the _acme-challenge.YourMainDomain TXT record on all nameservers:...

see Godaddy API key
see Godaddy.sh for detail

  • new Frontend IP and port for HTTPS from web UI at first time

    • keep the ${target_proxy_name} (under Network services/Load balancing/Target-proxies) as the parameters of the following commands.
  • create the certificates into Network services/Load balancing/Certificate

gcloud compute ssl-certificates create ${cert_name_in_lb}-$(date +%Y%m%d) \
--certificate /etc/dehydrated/certs/${domain_name}/fullchain.pem \
--private-key /etc/dehydrated/certs/${domain_name}/privkey.pem
  • update SSL cretificates before expiration
gcloud compute target-https-proxies update ${target_proxy_name} \
--ssl-certificates ${cert_name_in_lb}-$(date +%Y%m%d)
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt install -f
apt-get install python3-pip
pip3 install num2words
  • enable to import data from Excel file format, i.e. xls
pip3 install xlrd
  • a library for writing data and formatting information to older Excel files (ie: .xls)
pip3 install xlwt

Chinese font

  • display Chinese char correctly in PDF
sudo apt-get install ttf-wqy-zenhei

GCP

  • copy odoo.conf from GCS to /etc/odoo/
  • add cloud SQL Domain-IP mapping to /etc/hosts
  • mkdir and chmod odoo ${data_dir}

Odoo installation and configuration

# wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
# echo "deb http://nightly.odoo.com/13.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list
# apt-get update && apt-get install odoo
  • list_db = False in odoo.conf
    • blocking the database selection and management screens, eg. ${ODOO_HOST}/web/database/manager
  • always check Security recommandations if setting up a public server

Enable Multi-Websites

  • Website => Configuration => Settings => Features => Multi-Websites

Enable Multi-companies

  • Settings => General Settings => Multi-companies => Multi-companies

Enable Multiple Sales Prices

  • Settings => Website => Pricing => Multiple Sales Prices per Product => Prices computed from formulas (discounts, margins, roundings)

Configure odoo with remote database

  • /etc/odoo/odoo.conf
    As the security issue, don't use postgre as the db_user.
    If so, you'll get the error message, e.g. Using the database user 'postgres' is a security risk, aborting.root@odoo12-prod:/etc/odoo

Configure odoo additional addons paths

  • /etc/odoo/odoo.conf
    addons_path = /usr/lib/python3/dist-packages/odoo/addons,/opt/odoo/addons
    /opt/odoo/addons contains the additional 3rd-party addons

Apps and Modules v13

Apps and Modules v12

TODO...

Configure outgoing email

User default page after login

  • Settings => Users => select an user => Preferences (tab) => Home Action => select a preferred action.

Product Categories

  • Inventory => Configurations => Products => Product Categories

Countries and States

  • Contacts => Configuration => Localization => Countries => key in "Taiwan" in [Search...] bar ) => States
  • set country with python script.

Reference