odoo如何在Visual Studio Code中调试

I know I'm a bit late but I have managed to work with Odoo 11.

My installation path is "C:\Program Files (x86)\Odoo 11.0\server"

Now open the vs code and goto Workspace settings and paste this:

{
"python.pythonPath": "C:\\Program Files (x86)\\Odoo 11.0\\python\\python.exe",
"python.linting.pylintEnabled": false,
// use this so the autocompleate/goto definition will work with python extension
"python.autoComplete.extraPaths": [
    "${workspaceRoot}/odoo/addons",
    "${workspaceRoot}/odoo",
    "${workspaceRoot}/odoo/openerp/addons"
],
//"python.linting.pylintPath": "optional: path to python use if you have environment path",
"python.linting.enabled": false,
//load the pylint_odoo
"python.linting.pylintArgs": [
    "--load-plugins",
    "pylint_odoo"
],
"python.formatting.provider": "yapf",
//"python.formatting.yapfPath": "optional: path to python use if you have environment path",
// "python.linting.pep8Path": "optional: path to python use if you have environment path",
"python.linting.pep8Enabled": true,
// add this auto-save option so the pylint will sow errors while editing otherwise
//it will only show the errors on file save
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 500,
// The following will hide the compiled file in the editor/ add other file to hide them from editor
"files.exclude": {
    "**/*.pyc": true
}
}

 

save it and open the code folder in vs "C:\Program Files (x86)\Odoo 11.0\server\odoo"

then goto debugging setting and a new configuration file and paste below code:

{
// 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": "Python: Odoo",
        "type": "python",
        "request": "launch",
        "stopOnEntry": false,
        "pythonPath": "${config:python.pythonPath}",
        "console": "externalTerminal",
        "program": "${workspaceRoot}\\..\\odoo-bin",
        "args": [
            "--config=${workspaceRoot}\\..\\odoo.conf",
        ],
        "cwd": "${workspaceRoot}",
        "env": {},
        "envFile": "${workspaceRoot}/.env",
        "debugOptions": [
            "RedirectOutput"
        ]
    }
]
}

 

and just hit the run button. remember vs code might give you some warning press ignore button and wait for the console to open and you are done. enjoy debugging and coding.

Don't forget to stop the Odoo service from window services.

转载于:https://my.oschina.net/ethanleellj/blog/3003084

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值