-
-
Save kerbrose/e646aaf9daece42b46091e2ca0eb55d0 to your computer and use it in GitHub Desktop.
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Odoo: Attach", | |
"type": "python", | |
"request": "attach", | |
"port": 8879, | |
"debugServer": 8888, | |
"host": "localhost", | |
"pathMappings": [ | |
{ | |
"localRoot": "${workspaceFolder}", | |
"remoteRoot": "/mnt/extra-addons", | |
} | |
], | |
"logToFile": true | |
//"preLaunchTask": "init docker", | |
//"postDebugTask": "stop docker" | |
} | |
] | |
} | |
//docker-compose run --rm -p 8888:3001 -p 8879:8069 odoo /usr/bin/python3 -m ptvsd --host 0.0.0.0 --port 3001 /usr/bin/odoo --db_user=odoo --db_host=db --db_password=odoo | |
//docker-compose run --rm -p 8888:3001 -p 8879:8069 odoo /usr/bin/python3 -m ptvsd --host 0.0.0.0 --port 3001 /usr/bin/odoo --test-enable --db_user=odoo --db_host=db --db_password=odoo | |
//docker-compose run --rm -p 8888:3001 -p 8879:8069 odoo /usr/bin/python3 -m debugpy --listen 0.0.0.0:3001 /usr/bin/odoo --db_user=odoo --db_host=db --db_password=odoo |
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "init docker", | |
"type": "shell", | |
"command": "docker-compose run -d -p 8888:3001 -p 8879:8069 odoo /usr/bin/python3 -m ptvsd --host 0.0.0.0 --port 3001 /usr/bin/odoo --db_user=odoo --db_host=db --db_password=odoo" | |
}, | |
{ | |
"label": "stop docker", | |
"type": "shell", | |
"command": "docker rm -f $(docker ps -a -q --filter ancestor=docker.core-bpo.net/dev/odoo/digital_wellnez --format='{{.ID}}')", | |
} | |
] | |
} |
make sure that you mapped the remoteRoot
correctly. I mean that in your docker image the path maybe different than /mnt/extra-addons
.
@atomixm
this is relative per project directory. it should be inside a folder as following
.vscode/launch.json
@kerbrose Can you pass an example docker-compose folder?
Hey there, I'm currently trying to setup a Odoo dev environment, but I can't seem to find out how to have the Odoo source file on my host machine with a mapped folder in my container.
Either I didn't clone the Odoo get and it's telling me Odoo has no attribute cli.
Or I did a clone in the host mapped folder and I get another error at launch.
What I'm missing is from it :
- An auto complete using VSCode Odoo IDE extension, it need an Odoo source in the project and can't find one
- An easier restarting of the server using F5, Ctrl+Shift+F5
I see you did manage to do it, I hope there's a way for Odoo 17 👌
@mathisgauthey
in my local developement environement, I make 2 files, a workspace file and a launcher file for each project/company. my directory structure is like the following:
odoo/
odoo_enterprise/
<Project Folder>/
for the first time I open the using code
command eg. I create a playground_odoo_17
folder and I open it using vscode command:
code playground_odoo_17
once vscode opens, I right click on vscode explorer and I click on Add Folder to Workspace
to add the 2 odoo folders, and
later on I save the workspace folder in path <Project Folder>/.vscode/
finally I save the following launcher file in the same path <Project Folder>/.vscode/
{
"version": "0.2.0",
"configurations": [
{
"name": "Odoo 17",
"program": "${workspaceFolder}/../odoo_17/odoo-bin",
"type": "python",
"request": "launch",
"args": [
"--config",
"${workspaceFolder}/.config/odoo.cfg",
"--db-filter",
"^17.*$",
// "-u",
// "pos_customization",
// "--dev",
// "xml,qweb"
// "--save",
// "--stop-after-init"
],
"justMyCode": false,
}
]
}
@mathisgauthey in my local developement environement, I make 2 files, a workspace file and a launcher file for each project/company. my directory structure is like the following:
odoo/ odoo_enterprise/ <Project Folder>/
for the first time I open the using
code
command eg. I create aplayground_odoo_17
folder and I open it using vscode command:code playground_odoo_17once vscode opens, I right click on vscode explorer and I click on
Add Folder to Workspace
to add the 2 odoo folders, andlater on I save the workspace folder in path
<Project Folder>/.vscode/
finally I save the following launcher file in the same path
<Project Folder>/.vscode/
{ "version": "0.2.0", "configurations": [ { "name": "Odoo 17", "program": "${workspaceFolder}/../odoo_17/odoo-bin", "type": "python", "request": "launch", "args": [ "--config", "${workspaceFolder}/.config/odoo.cfg", "--db-filter", "^17.*$", // "-u", // "pos_customization", // "--dev", // "xml,qweb" // "--save", // "--stop-after-init" ], "justMyCode": false, } ] }
Hey there, thanks for the input !
The issue is that it doesn't seem to allow for an easy debugging process using Odoo source code alongside custom modules. Here's what I tried, without success.
hi can you help me please I am running odoo with docker-compose, is there a way to add the commands in the yml file? I am currently installing pip3 install debugpy with docker exec and then run the command
python3 -m debugpy --listen 0.0.0.0:3001 /usr/bin/odoo -w odoo -r odoo --db_host db -p 5432
when executing it in vsc it is marked in orange and it tells me that the points are on a file that does not exist, please if you can help me I would greatly appreciate it since the debug is something that helps a lot
docker-compose.txt