'Volume odoo. Permission issue

Ubuntu 18.04. I am using odoo docker files

docker-compose:

version: '3.7'
services:
  web:
    build: ./build 
#    image: odoo:13.0
#    user: root
    depends_on:
      - mydb
    ports:
      - "18275:8069"
    environment:
      - HOST=mydb
      - USER= us
      - PASSWORD=pw
    restart: always
    volumes:
      - ./odoo:/usr/lib/python3/dist-packages/odoo
      - ./config:/etc/odoo
      - ./extra-addons:/mnt/extra-addons
  mydb:
    image: postgres:12.1
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=pw
      - POSTGRES_USER=us
    restart: always

In ./build directory I have docker files from odoo github repository.

I have problems with volumes: ./odoo:/usr/lib/python3/dist-packages/odoo

My odoo container is restarting with logs:

web_1   | Traceback (most recent call last):
web_1   |   File "/usr/bin/odoo", line 8, in <module>
web_1   |     odoo.cli.main()
web_1   | AttributeError: module 'odoo' has no attribute 'cli'

I think it's permission issue. I added some permission, I changed user and group owner and nothing...

What should I do to create this volume?

Without this one volume everything works great



Solution 1:[1]

Sorry my answer is so late - maybe we can help someone else who has this error.

Consider how simple Odoo-bin is:

#!/usr/bin/env python3

# set server timezone in UTC before time module imported
__import__('os').environ['TZ'] = 'UTC'
import odoo

if __name__ == "__main__":

This error: "odoo has no attribute 'cli'" can happen if the odoo program files are not where Odoo-bin expects them to be. The fifth line in Odoo-bin is 'import odoo', and if it isn't there, you will get this error.

And as you have guessed, if your odoo user doesn't have permissions to READ the odoo files, Odoo-bin will also throw this error when it cannot import from a folder it cannot even see.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 frozenjim