Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug in PyCharm - where is the source code in the odoo image? #516

Open
mikerocker11 opened this issue Aug 31, 2024 · 2 comments
Open

Debug in PyCharm - where is the source code in the odoo image? #516

mikerocker11 opened this issue Aug 31, 2024 · 2 comments

Comments

@mikerocker11
Copy link

Hi,

I recently switched from a source-based installation to a Docker-based setup. Here's the docker-compose.yml file I'm using:

version: '3.1'
services:
  web:
    image: odoo:17.0
    depends_on:
      - db
    ports:
      - "8069:8069"
    volumes:
      - odoo-web-data:/var/lib/odoo
      - ./config:/etc/odoo
      - ./addons:/mnt/extra-addons
    environment:
      - PASSWORD_FILE=/run/secrets/postgresql_password
    secrets:
      - postgresql_password
  db:
    image: postgres:15
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD_FILE=/run/secrets/postgresql_password
      - POSTGRES_USER=odoo
      - PGDATA=/var/lib/postgresql/data/pgdata
    volumes:
      - odoo-db-data:/var/lib/postgresql/data/pgdata
    secrets:
      - postgresql_password
volumes:
  odoo-web-data:
  odoo-db-data:

secrets:
  postgresql_password:
    file: odoo_pg_pass

When I was using the source-based installation, I was able to configure PyCharm correctly for debugging. My question is:

Where can I find the source code for the odoo:17.0 image so that I can assign it to a volume, view the code in PyCharm, and set breakpoints?

@amh-mw
Copy link

amh-mw commented Sep 2, 2024

Where can I find the source code for the odoo:17.0 image so that I can assign it to a volume, view the code in PyCharm, and set breakpoints?

The odoo Dockerfile does a pip install of the odoo package, so on my odoo:15 pip show odoo returns Location: /usr/lib/python3/dist-packages. Now for the unfortunate part. The packaging process changes the file hierarchy a little bit, so I think you will need two volumes at least:

  • ./odoo/odoo:/usr/lib/python3/dist-packages/odoo
  • ./odoo/addons:/usr/lib/python3/dist-packages/odoo/addons

I haven't tried this myself, as when I get to the level of confusion that makes me want to install a debugger, I write unit tests instead. Another angle of attack might be to try one of the community container images that is already set up for debugging:

@leimantas
Copy link

You can create a symbolic link. Check my repo: https://github.com/leimantas/odoo-dev/blob/main/odoo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants