如何在Ubuntu的Visual Studio Code上的Odoo v11中开发(运行和调试)模块? [英] How to develop (run and debug) modules in Odoo v11 on Visual Studio Code in Ubuntu?

查看:133
本文介绍了如何在Ubuntu的Visual Studio Code上的Odoo v11中开发(运行和调试)模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Visual Studio Code上运行和调试Odoo?如果是,请分享给我.

Is it possible to run and debug Odoo on Visual Studio Code? If yes please share me the configuration.

> Visual Studio代码 是Microsoft为Windows开发的源代码编辑器,Linux和macOS.它包括对调试,嵌入式Git控制,语法突出显示,智能代码完成,代码段和代码重构的支持.它是免费和开源的,尽管官方下载已获得专有许可.

Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring. It is free and open-source, although the official download is under a proprietary license.

推荐答案

我知道我来晚了一些,但我设法使用了Odoo 11.

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

我的安装路径是"C:\ Program Files(x86)\ Odoo 11.0 \ server"

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

现在打开vs代码并转到Workspace设置并将其粘贴:

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
}

}

保存它并在vs"C:\ Program Files(x86)\ Odoo 11.0 \ server \ odoo"中打开代码文件夹

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"
        ]
    }
]

}

,然后点击运行按钮.记住vs代码可能会给您一些警告,请按忽略"按钮,然后等待控制台打开并完成操作.享受调试和编码的乐趣.

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.

别忘了从窗口服务中停止 Odoo服务.

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

这篇关于如何在Ubuntu的Visual Studio Code上的Odoo v11中开发(运行和调试)模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆