├── requirements.txt ├── pyrightconfig.json ├── .env ├── Dockerfile ├── .gitignore ├── UTILS.md ├── docker-compose.yml ├── README.md ├── conf └── odoo.conf └── entrypoint.sh /requirements.txt: -------------------------------------------------------------------------------- 1 | debugpy 2 | pydevd-odoo 3 | -------------------------------------------------------------------------------- /pyrightconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extraPaths": ["/path/server/odoo", "/path/server/odoo/addons", "/path/custom_addons"] 3 | } 4 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME= 2 | ODOO_VERSION=18.0 3 | ODOO_CONTAINER_NAME=odoo 4 | ODOO_PORT=8069 5 | DEBUGPY_PORT=8888 6 | DEBUGPY_AUX_PORT=8070 # Puerto auxiliar para odoo, al activar el debugpy genera conflicto con el 8069, por eso se coloca uno aparte 7 | PG_CONTAINER_NAME=pgdb 8 | PG_VERSION=16.0 9 | PG_USER=openpg 10 | PG_PASSWORD=openpgpwd 11 | PG_PORT=5432 12 | ODOO_SERVER= 13 | CUSTOM_ADDONS= 14 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM odoo:18.0 2 | 3 | USER root 4 | 5 | COPY --chown=odoo:odoo ./requirements.txt /tmp/ 6 | 7 | RUN apt-get update \ 8 | && apt-get install -y git gcc swig python3-m2crypto unzip curl python3-venv \ 9 | && curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ 10 | && python3 get-pip.py --break-system-packages --ignore-installed\ 11 | && rm get-pip.py 12 | 13 | RUN pip install setuptools==69.0.3 wheel --break-system-packages 14 | RUN pip install -r /tmp/requirements.txt --break-system-packages 15 | 16 | COPY entrypoint.sh /entrypoint.sh 17 | RUN chmod +x /entrypoint.sh 18 | 19 | USER odoo 20 | 21 | ENTRYPOINT ["/entrypoint.sh"] 22 | CMD ["odoo"] 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### macOS ### 2 | # General 3 | .DS_Store 4 | .AppleDouble 5 | .LSOverride 6 | 7 | # Thumbnails 8 | ._* 9 | 10 | # Files that might appear in the root of a volume 11 | .DocumentRevisions-V100 12 | .fseventsd 13 | .Spotlight-V100 14 | .TemporaryItems 15 | .Trashes 16 | .VolumeIcon.icns 17 | .com.apple.timemachine.donotpresent 18 | 19 | # Directories potentially created on remote AFP share 20 | .AppleDB 21 | .AppleDesktop 22 | Network Trash Folder 23 | Temporary Items 24 | .apdisk 25 | 26 | ### Windows ### 27 | # Windows thumbnail cache files 28 | Thumbs.db 29 | Thumbs.db:encryptable 30 | ehthumbs.db 31 | ehthumbs_vista.db 32 | 33 | # Dump file 34 | *.stackdump 35 | 36 | # Folder config file 37 | [Dd]esktop.ini 38 | 39 | # Recycle Bin used on file shares 40 | $RECYCLE.BIN/ 41 | 42 | # Windows Installer files 43 | *.cab 44 | *.msi 45 | *.msix 46 | *.msm 47 | *.msp 48 | 49 | # Windows shortcuts 50 | *.lnk 51 | 52 | ### Python ### 53 | # compiled python files 54 | *.py[co] 55 | __pycache__/ 56 | -------------------------------------------------------------------------------- /UTILS.md: -------------------------------------------------------------------------------- 1 | # Útiles 2 | 3 | ## Master Password 4 | 5 | `88mr-i2sy-jenm` 6 | 7 | ## Master Password Encriptada 8 | 9 | `$pbkdf2-sha512$25000$oZSylpJyzrn33vs/53xPiQ$10slfAFf/Z2fnDRjlTGr9Tp0oZoKxDd9yDP1WgbiONGeXOHxLur7zG21b83PDwEDUFEXLDdPAczuzx3PAGMsvg` 10 | 11 | ## Establecer y restablecer la password del usuario administrador de Odoo 12 | 13 | ```sql 14 | UPDATE res_users SET PASSWORD = '$pbkdf2-sha512$25000$oZSylpJyzrn33vs/53xPiQ$10slfAFf/Z2fnDRjlTGr9Tp0oZoKxDd9yDP1WgbiONGeXOHxLur7zG21b83PDwEDUFEXLDdPAczuzx3PAGMsvg' WHERE id = 2; 15 | ``` 16 | 17 | ## Usuario Admin de Odoo 18 | 19 | ```sql 20 | SELECT login, PASSWORD FROM res_users WHERE id = 2; 21 | ``` 22 | 23 | ### Actualizar la fecha de creación y expiración de la base de datos Enterprise 24 | 25 | ```sql 26 | UPDATE ir_config_parameter SET value = to_char(CURRENT_TIMESTAMP, 'YYYY-MM-DD HH:MI:SS') WHERE key = 'database.create_date'; 27 | UPDATE ir_config_parameter SET value = to_char(CURRENT_TIMESTAMP + INTERVAL '30 days', 'YYYY-MM-DD') WHERE key = 'database.expiration_date'; 28 | ``` 29 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | web: 3 | container_name: ${ODOO_CONTAINER_NAME} 4 | image: odoodev:${ODOO_VERSION} 5 | # Comandos de odoo (actualizar, instalar, herramientas, etc) 6 | # command: odoo -u -d --dev=xml,qweb,reload 7 | depends_on: 8 | - db 9 | ports: 10 | - "${ODOO_PORT}:8069" 11 | - "${DEBUGPY_PORT}:${DEBUGPY_PORT}" 12 | volumes: 13 | - ./conf:/etc/odoo 14 | - odoo-web-data:/var/lib/odoo 15 | - ${ODOO_SERVER}:/var/lib/odoo/odoo 16 | - ${CUSTOM_ADDONS}:/var/lib/odoo/custom_addons 17 | enviroment: 18 | - DEBUGPY=true 19 | - DEBUGPY_PORT=${DEBUGPY_PORT} 20 | - DEBUGPY_AUX_PORT=${DEBUGPY_AUX_PORT} 21 | db: 22 | container_name: ${PG_CONTAINER_NAME} 23 | image: postgres:${PG_VERSION} 24 | environment: 25 | - POSTGRES_DB=postgres 26 | - POSTGRES_PASSWORD=${PG_PASSWORD} 27 | - POSTGRES_USER=${PG_USER} 28 | - PGDATA=/var/lib/postgresql/data/pgdata 29 | ports: 30 | - ${PG_PORT}:5432 31 | volumes: 32 | - pgdb-data:/var/lib/postgresql/data/pgdata 33 | volumes: 34 | odoo-web-data: 35 | pgdb-data: 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VSCode + Docker para el desarrollo en Odoo con completado inteligente 2 | 3 | 1. Instalar VSCode de su página oficial - 4 | 2. Instalar extensiones en vscode para la productividad: 5 | 6 | - Odoo IDE 7 | 8 | - Odoo Shortcuts 9 | 10 | - Owl Vision 11 | 12 | 3. Crear el espacio de trabajo importando el código fuente de Odoo 13 | 4. Configurar y modificar el fichero pyrightconfig.json 14 | 5. Compilar la imagen de docker con el fichero Dockerfile 15 | 6. Configurar las variables en el .env 16 | 7. Configurar el debug en vscode 17 | 18 | Ejemplo: 19 | 20 | ```json 21 | { 22 | "name": "Docker Odoo Attach", 23 | "type": "debugpy", 24 | "request": "attach", 25 | "connect": { 26 | "host": "0.0.0.0", 27 | "port": 8888 28 | }, 29 | "pathMappings": [ 30 | { 31 | "localRoot": "${workspaceFolder}/addons", 32 | "remoteRoot": "/var/lib/odoo/custom_addons" 33 | }, 34 | { 35 | "localRoot": "/addons", 36 | "remoteRoot": "/var/lib/odoo/odoo/addons" 37 | } 38 | ] 39 | } 40 | ``` 41 | -------------------------------------------------------------------------------- /conf/odoo.conf: -------------------------------------------------------------------------------- 1 | [options] 2 | addons_path = /var/lib/odoo/odoo/addons,/var/lib/odoo/custom_addons 3 | admin_passwd = $pbkdf2-sha512$25000$oZSylpJyzrn33vs/53xPiQ$10slfAFf/Z2fnDRjlTGr9Tp0oZoKxDd9yDP1WgbiONGeXOHxLur7zG21b83PDwEDUFEXLDdPAczuzx3PAGMsvg 4 | csv_internal_sep = , 5 | data_dir = /var/lib/odoo/.local/share/Odoo 6 | db_host = db 7 | db_maxconn = 64 8 | db_name = False 9 | db_password = openpgpwd 10 | db_port = 5432 11 | db_sslmode = prefer 12 | db_template = template0 13 | db_user = openpg 14 | dbfilter = 15 | demo = {} 16 | email_from = False 17 | from_filter = False 18 | geoip_database = /usr/share/GeoIP/GeoLite2-City.mmdb 19 | http_enable = True 20 | http_interface = 21 | http_port = 8069 22 | import_partial = 23 | limit_memory_hard = 2684354560 24 | limit_memory_soft = 2147483648 25 | limit_request = 8192 26 | limit_time_cpu = 60 27 | limit_time_real = 0 28 | limit_time_real_cron = -1 29 | list_db = True 30 | log_db = False 31 | log_db_level = warning 32 | log_handler = :INFO 33 | log_level = info 34 | logfile = 35 | longpolling_port = 8072 36 | max_cron_threads = 2 37 | osv_memory_age_limit = False 38 | osv_memory_count_limit = False 39 | pg_path = 40 | pidfile = 41 | proxy_mode = False 42 | reportgz = False 43 | screencasts = 44 | screenshots = /tmp/odoo_tests 45 | server_wide_modules = base,web 46 | smtp_password = False 47 | smtp_port = 25 48 | smtp_server = localhost 49 | smtp_ssl = False 50 | smtp_ssl_certificate_filename = False 51 | smtp_ssl_private_key_filename = False 52 | smtp_user = False 53 | syslog = False 54 | test_enable = False 55 | test_file = 56 | test_tags = None 57 | transient_age_limit = 1.0 58 | translate_modules = ['all'] 59 | unaccent = False 60 | upgrade_path = 61 | without_demo = False 62 | workers = 0 63 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -v PASSWORD_FILE ]; then 6 | PASSWORD="$(< $PASSWORD_FILE)" 7 | fi 8 | 9 | # set the postgres database host, port, user and password according to the environment 10 | # and pass them as arguments to the odoo process if not present in the config file 11 | : ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}} 12 | : ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}} 13 | : ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}} 14 | : ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}} 15 | 16 | DB_ARGS=() 17 | function check_config() { 18 | param="$1" 19 | value="$2" 20 | if grep -q -E "^\s*\b${param}\b\s*=" "$ODOO_RC" ; then 21 | value=$(grep -E "^\s*\b${param}\b\s*=" "$ODOO_RC" |cut -d " " -f3|sed 's/["\n\r]//g') 22 | fi; 23 | DB_ARGS+=("--${param}") 24 | DB_ARGS+=("${value}") 25 | } 26 | check_config "db_host" "$HOST" 27 | check_config "db_port" "$PORT" 28 | check_config "db_user" "$USER" 29 | check_config "db_password" "$PASSWORD" 30 | 31 | case "$1" in 32 | -- | odoo) 33 | shift 34 | if [[ "$1" == "scaffold" ]] ; then 35 | exec odoo "$@" 36 | else 37 | wait-for-psql.py ${DB_ARGS[@]} --timeout=30 38 | # debugpy solo si la variable está definida 39 | if [ -n "$DEBUGPY" ]; then 40 | exec python3 -m debugpy --listen 0.0.0.0:$DEBUGPY_PORT /usr/bin/odoo -c /etc/odoo/odoo.conf --http-port=$DEBUGPY_AUX_PORT & odoo "$@" "${DB_ARGS[@]}" 41 | else 42 | exec odoo "$@" "${DB_ARGS[@]}" 43 | fi 44 | fi 45 | ;; 46 | -*) 47 | wait-for-psql.py ${DB_ARGS[@]} --timeout=30 48 | # debugpy solo si la variable está definida 49 | if [ -n "$DEBUGPY" ]; then 50 | exec python3 -m debugpy --listen 0.0.0.0:$DEBUGPY_PORT /usr/bin/odoo -c /etc/odoo/odoo.conf --http-port=$DEBUGPY_AUX_PORT & odoo "$@" "${DB_ARGS[@]}" 51 | else 52 | exec odoo "$@" "${DB_ARGS[@]}" 53 | fi 54 | ;; 55 | *) 56 | exec "$@" 57 | esac 58 | 59 | exit 1 --------------------------------------------------------------------------------