Browse Source

Initial commit

pull/101/head
Elouan 2 years ago
commit
dfbbf17d15
  1. 34
      .gitignore
  2. 35
      Dockerfile
  3. 114
      README.md
  4. 21
      docker-compose.yml
  5. 259
      install-odoo-linux-server.md
  6. 56
      install-odoo-linux.md
  7. 78
      install-odoo-mac.md
  8. 2
      requirements.txt

34
.gitignore

@ -0,0 +1,34 @@
# sphinx build directories
_build/
# dotfiles
.*
!.gitignore
!.mailmap
# compiled python files
*.py[co]
# setup.py egg_info
*.egg-info
# emacs backup files
*~
# hg stuff
*.orig
status
# odoo filestore
openerp/filestore
# maintenance migration scripts
openerp/addons/base/maintenance
# generated for windows installer?
install/win32/*.bat
install/win32/meta.py
# various virtualenv
/bin/
/build/
/dist/
/include/
/lib/
/man/
/share/
/src/

35
Dockerfile

@ -0,0 +1,35 @@
FROM odoo:9.0
USER root
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
RUN apt-get update && apt-get install -y git wget gcc python-dev libssl-dev libffi-dev make
##### 10) Installer wkhtml to pdf 0.12.1 !! (pas une autre) (sur une machine 64 bit avec un ubuntu 64bit 14.04)
# RUN apt-get install -y fontconfig libfontconfig1 libxrender1 fontconfig-config libjpeg-turbo8-dev && \
# wget --quiet https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb && \
# dpkg -i wkhtmltox_0.12.5-1.trusty_amd64.deb && \
# ln -s /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage && \
# ln -s /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
RUN mkdir -p /app/extra-addons && chown odoo /app/extra-addons
USER odoo
RUN git clone https://github.com/beescoop/Obeesdoo.git /app/extra-addons/obeesdoo -b 9.0 --depth 1 && \
git clone https://github.com/coopiteasy/vertical-cooperative.git /app/extra-addons/vertical-cooperative -b 9.0 --depth 1 && \
git clone https://github.com/coopiteasy/addons.git /app/extra-addons/houssine-addons -b 9.0 --depth 1 && \
git clone https://github.com/coopiteasy/procurement-addons /app/extra-addons/procurement-addons -b 9.0 --depth 1 && \
git clone https://www.github.com/OCA/l10n-belgium /app/extra-addons/l10n-belgium -b 9.0 --depth 1 && \
git clone https://www.github.com/OCA/mis-builder /app/extra-addons/mis-builder -b 9.0 --depth 1 && \
git clone https://www.github.com/OCA/web /app/extra-addons/web -b 9.0 --depth 1 && \
git clone https://github.com/OCA/server-tools /app/extra-addons/server-tools -b 9.0 --depth 1 && \
git clone https://github.com/OCA/reporting-engine /app/extra-addons/reporting-engine -b 9.0 --depth 1
USER root
RUN pip install --upgrade setuptools enum
RUN pip install -r /app/extra-addons/reporting-engine/requirements.txt
RUN pip install -r /app/extra-addons/server-tools/requirements.txt
RUN pip install -r /app/extra-addons/obeesdoo/requirements.txt
USER odoo
# COPY example_odoo.conf /etc/odoo/openerp-server.conf

114
README.md

@ -0,0 +1,114 @@
# Obeesdoo
Specific module for the Beescoop
## Install odoo
- cf. [install-odoo-linux-server.md](install-odoo-linux-server.md) (review)
- cf. [install-odoo-linux.md](install-odoo.md) (review)
- cf. [install-odoo-mac.md](install-odoo-mac.md)
## Setup obeesdoo
##### 1) clone repos
```
$ cd projects
$ git clone https://github.com/beescoop/Obeesdoo.git obeesdoo -b 9.0 --depth 1
$ git clone https://github.com/coopiteasy/vertical-cooperative.git vertical-cooperative -b 9.0 --depth 1
$ git clone https://github.com/coopiteasy/addons.git addons -b 9.0 --depth 1
$ git clone https://github.com/coopiteasy/procurement-addons procurement-addons -b 9.0 --depth 1
$ git clone https://www.github.com/OCA/l10n-belgium -b 9.0 --depth 1
$ git clone https://www.github.com/OCA/mis-builder -b 9.0 --depth 1
$ git clone https://www.github.com/OCA/account-financial-tools -b 9.0 --depth 1
$ git clone https://www.github.com/OCA/account-financial-reporting -b 9.0 --depth 1
$ git clone https://www.github.com/OCA/web -b 9.0 --depth 1
$ git clone https://www.github.com/OCA/website -b 9.0 --depth 1
$ git clone https://github.com/OCA/server-tools -b 9.0 --depth 1
$ git clone https://github.com/OCA/reporting-engine -b 9.0 --depth 1
```
todo: setup git submodules
##### 2) install wkhtmltopdf
Download and install [wkhtmltopdf version 0.12.1](https://github.com/wkhtmltopdf/wkhtmltopdf/releases/0.12.1)
##### 3) set up the database and import production data.
```
$ createuser -d odoo
$ createdb beescoop -o odoo
$ gunzip <dump-file>.sql.gz
$ psql beescoop < <dump-file>.sql
```
##### 4) deactivate cron jobs and mails
```
$ psql -d beescoop -c "UPDATE ir_cron SET active='f' WHERE active='t';"
$ psql -d beescoop -c "update ir_mail_server set smtp_encryption='none', smtp_port=1025, smtp_host='localhost',smtp_user='', smtp_pass='';"
$ psql -d beescoop -c "UPDATE fetchmail_server SET active='f', password='', server='localhost';"
```
##### 5) create odoo.conf
```
$ export ODOO_HOME='~/projects'
$ vi $ODOO_HOME/odoo.conf
```
```
[options]
; This is the password that allows database operations:
; admin_passwd = admin
debug=True
dev=True
db_host=False
db_port=False
db_user=odoo
db_password=False
addons_path=addons,openerp/addons,
$ODOO_HOME/obeesdoo,
$ODOO_HOME/vertical-cooperative,
$ODOO_HOME/addons,
$ODOO_HOME/procurement-addons,
$ODOO_HOME/l10n-belgium,
$ODOO_HOME/mis-builder,
$ODOO_HOME/web,
$ODOO_HOME/website,
$ODOO_HOME/server-tools,
$ODOO_HOME/reporting-engine,
$ODOO_HOME/account-financial-tools,
$ODOO_HOME/acconut-financial-reporting
```
##### 6) update database structure
```
$ cd ~/projects/odoo
$ psql -d beescoop -c "truncate product_scale_log"
$ python odoo.py -c $ODOO_HOME/odoo.conf -u all -d beescoop --stop-after-init
```
### Troubleshoot
Missing libraries
```
pip install pycoda
pip install xlsxwriter
```
Can't update `product_scale_log` table (I did not write down the exact error)
```
truncate table product_scale_log
```
## Migrate barcode
```sql
insert into member_card (active, barcode, partner_id, responsible_id, activation_date) select 't', barcode, id, 1, '2016-01-01' from res_partner where barcode is not null;
update res_partner set eater = 'worker_eater' where barcode is not null;
```

21
docker-compose.yml

@ -0,0 +1,21 @@
version: '3'
services:
odoo:
build: .
depends_on:
- db
ports:
- "8069:8069"
volumes:
- ./config:/etc/odoo/
- ./:/app/extra-addons/obeesdoo
db:
image: postgres:10
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo

259
install-odoo-linux-server.md

@ -0,0 +1,259 @@
# Install odoo on a linux server
> by Thibault François
## Installation basique
##### 1) ajouter un utilisateur odoo
# adduser odoo
##### 2) installation de postgresql (DBMS)
# apt-get install postgresql
##### 3) install git
# apt-get install git
##### 4) installer pip : python package manager
# apt-get install python-pip
##### 5) installation des paquets devel pour compilation des bibliothèques python
# apt-get install python-dev postgresql-server-dev-all libjpeg-dev zlib1g-dev libpng12-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev
##### 6) installation de node-less
# apt-get install node-less
##### 7) clone odoo
# su odoo
$ cd /home/odoo
$ git clone https://github.com/odoo/odoo.git
##### 8) installer bibliothèque python
$ exit
# cd /home/odoo/odoo
# pip install -r requirements.txt
##### 9) créer odoo user pour postgresql avec les droits de création de base de donnée
# su postgres
$ createuser -d odoo
$ exit
##### 10) Installer wkhtml to pdf 0.12.1 !! (pas une autre) (sur une machine 64 bit avec un ubuntu 64bit 14.04)
# apt-get install fontconfig libfontconfig1 libxrender1 fontconfig-config
# wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
# dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
# cd /usr/local/bin/
# cp wkhtmltoimage /usr/bin/wkhtmltoimage
# cp wkhtmltopdf /usr/bin/wkhtmltopdf
##### 11) Tester l'installation de odoo
# su odoo
$ cd /home/odoo/odoo
$ ./odoo.py
lancer le navigateur http://localhost:8069 la page de création de base de donnée d'odoo devrait s'ouvrir, essayé de créer une base de donnée
ctrl + c pour tuer le processus odoo depuis la console
## Pour aller plus loin: init.d script
##### 1) créer un répertoire de log
# su odoo
$ mkdir /home/odoo/log
##### 2) créer fichier de config odoo
$ cd /home/odoo/odoo
$ ./odoo.py -s -c /home/odoo/odoo.conf --stop-after-init --logfile=/home/odoo/log/odoo.log
##### 3) Créer le fichier init.d
$ exit
$ vim /etc/init.d/odoo
copier le contenu dans le fichier (gedit va aussi bien que vim)
#!/bin/sh
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enterprise Resource Management software
# Description: Open ERP is a complete ERP and CRM software.
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
DAEMON=/home/odoo/odoo/odoo.py
NAME=odoo
DESC=odoo
# Specify the user name (Default: openerp).
USER=odoo
# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/home/odoo/odoo.conf"
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"
[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}
case "${1}" in
start)
echo -n "Starting ${DESC}: "
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- ${DAEMON_OPTS}
echo "${NAME}."
;;
stop)
echo -n "Stopping ${DESC}: "
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
--oknodo
echo "${NAME}."
;;
restart|force-reload)
echo -n "Restarting ${DESC}: "
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
--oknodo
sleep 1
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- ${DAEMON_OPTS}
echo "${NAME}."
echo "${NAME}."
;;
*)
N=/etc/init.d/${NAME}
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
##### 4) donner les bons droits au fichier
# chmod 755 /etc/init.d/odoo
##### 5) tester le script
# /etc/init.d/odoo start
tester à nouveau sur localhost:8069
##### 6) faire en sorte que le script s'exécute au démarrage
# update-rc.d odoo defaults
## Pour aller plus loin: proxy nginx
##### 1) installer nginx
# apt-get install nginx
vous pouvez tester l'installation réussie sur http://localhost
##### 2) configurer nginx pour odoo : editer le fichier de conf
# vim /etc/nginx/sites-enabled/default
supprimer le contenu et le remplacer par
upstream odoo {
server 127.0.0.1:8069 weight=1 fail_timeout=300s;
}
server {
# server port and name
listen 80;
server_name localhost;
location / {
proxy_pass http://odoo;
# force timeouts if the backend dies
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# set headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
}
}
##### 3) tester la config et relancer nginx
# nginx -t
# nginx -s reload
tester http://localhost
devrait conduire à odoo (ne pas oublier de vider le cache de son navigateur au cas ou ca ne marche pas tout de suite)
## Sécurité
> odoo plus accessible sur le port et changer le master password
a) editer fichier de conf de odoo
# vim /home/odoo/odoo.conf
changer
admin_passwd = admin
xmlrpc_interface =
pour
admin_passwd = secret_password
xmlrpc_interface = 127.0.0.1
b) redémarrer odoo
# /etc/init.d/odoo restart

56
install-odoo-linux.md

@ -0,0 +1,56 @@
# Install odoo on linux
> Tested on Ubuntu 18
##### 2) Install Python, postgresql and needed modules
Python 2.7 and 3 come pre-installed but you'll need to add pip
```
sudo apt-get install python-pip
sudo apt-get install postgresql
sudo apt-get install libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libssl-dev -y
sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
```
##### 4) install less compiler
```
$ sudo apt-get install npm
$ sudo npm install -g less less-plugin-clean-css
```
##### 5) setup odoo environment
I recommend using [virtualenvwrapper](http://virtualenvwrapper.readthedocs.io/en/latest/index.html)
```
$ mkvirtualenv odoo -p /path/to/python2.7 # generally /usr/bin/python2.7
$ which python # should return:
/Users/<user>/.virtualenvs/odoo/bin/python
```
Use `deactivate` to get out of odoo environment, use `workon odoo` to activate the environment.
##### 6) clone odoo
```
$ cd ~/projects
$ git clone https://github.com/odoo/odoo.git odoo
```
##### 7) Install odoo requirements
```
$ cd odoo
$ git checkout 9.0
$ pip install -r requirements.txt
# we need to upgrade psycopg2
pip uninstall psycopg2
pip install --no-binary :all: psycopg2
```
You should now be able to start a simple odoo instance with `./odoo/odoo.py`

78
install-odoo-mac.md

@ -0,0 +1,78 @@
# Install odoo on macos
> Tested on macos High Sierra (10.13.3)
##### 1) install Homebrew
```
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
##### 2) Install Python, postgresql and needed modules
```
$ brew update
$ brew install python
$ brew install postgresql
$ brew install freetype jpeg libpng libtiff webp xz
```
##### 3) Add postgresql to system startup
```
$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
```
##### 4) install less compiler
```
$ brew install npm
$ npm install -g less
```
##### 5) setup odoo environment
I recommend using [virtualenvwrapper](http://virtualenvwrapper.readthedocs.io/en/latest/index.html)
```
$ mkvirtualenv odoo -p /path/to/python2.7 # generally /usr/bin/python2.7
$ which python # should return:
/Users/<user>/.virtualenvs/odoo/bin/python
```
Use `deactivate` to get out of odoo environment, use `workon odoo` to activate the environment.
##### 6) clone odoo
```
$ cd ~/projects
$ git clone https://github.com/odoo/odoo.git odoo
```
##### 7) Install odoo requirements
```
$ cd odoo
$ git checkout 9.0
$ pip install -r requirements.txt
```
You should now be able to start a simple odoo instance with `python odoo.py`
## Configuring pycharm
## Troubleshoot
Missing codaparserexception
```
pip install pycoda
```
Can't update `product_scale_log` table (I did not write down the exact error)
```
truncate table product_scale_log
```
## Source
source: [setup-odoo-development-on-os-x-with-pycharm](http://bloopark.de/en_US/blog/the-bloopark-times-english-2/post/setup-odoo-development-on-os-x-with-pycharm-109)

2
requirements.txt

@ -0,0 +1,2 @@
pycoda
openerp-client-lib
Loading…
Cancel
Save