Search code examples
dockerdocker-composeodooodoo-13

Addons in Docker Odoo 13.0 not recognized


I try to use latest (13.0) Docker image for local development and I'm using docker-compose.yml from docker documentation for spinning up containers:

version: '2'
services:
  web:
    image: odoo:13.0
    depends_on:
      - db
    ports:
      - "8069:8069"
    volumes:
      - ./config:/etc/odoo
      - ./addons/my_module:/mnt/extra-addons
  db:
    image: postgres:10
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=odoo
      - POSTGRES_USER=odoo
      - PGDATA=/var/lib/postgresql/data/pgdata

My odoo.conf:

[options]
addons_path = /mnt/extra-addons
data_dir = /var/lib/odoo

My file structure:

├── addons
│   └── my_module
│       ├──controllers
│       ├──demo
│       ├──models
│       ├──security
│       ├──views
│       ├──__init__.py
│       └──__manifest__.py
├── config
│   └── odoo.conf
├── docker-compose.yml
└── README.md

my_module is default module strucure from odoo website (with uncommented code) so I'm assuming it has no errors.

When I start the containers with command docker-compose up -d it starts the database and odoo without any errors (in docker and in browser console) but my_module is not visible inside application. I turned on developer mode and Updated Apps list inside App tab as suggested in other issues on github and SO but my_module is still not visible. Additionally if I login to container with docker exec -u root -it odoo /bin/bash I can cd to /mnt/extra-addons and I can see the contents of my_module mounted to container so it seems as Odoo does not recognize it?

I scanned the interned and found many similar problems but none of the solutions worked for me so I'm assuming I'm doing something wrong.


Solution

  • After some research I ended up with this docker-compose.yml which does load custom addons to my Docker:

    version: '2'
    services:
      db:
        image: postgres:11
        environment:
          - POSTGRES_PASSWORD=odoo
          - POSTGRES_USER=odoo
          - POSTGRES_DB=postgres
        restart: always
      odoo:
        image: odoo:13
        depends_on:
          - db
        ports:
          - "8069:8069"
        tty: true
        command: -- --dev=reload
        volumes:
          - ./addons:/mnt/extra-addons
          - ./etc:/etc/odoo
        restart: always
    

    odoo.conf:

    [options]
    addons_path = /mnt/extra-addons
    logfile = /etc/odoo/odoo-server.log