win11下安装odoo17
odoo17发行了,据说,UI做了很大改进,今天有空,体验一下
打开官方仓库: https://github.com/odoo/odoo
默认的版本已经变成17了
打开odoo/odoo/init.py,发现对python版本的要求也提高了
assert sys.version_info > (3, 10), "Outdated python version detected, Odoo requires Python >= 3.10 to run."
1、clone odoo17代码
git clone https://gitee.com/mirrors/odoo.git --depth 1 --branch 17.0 --single-branch odoo17
速度还行
D:\BaiduSyncdisk\odoo\odoo17>git clone https://gitee.com/mirrors/odoo.git --depth 1 --branch 17.0 --single-branch odoo17Cloning into 'odoo17'...remote: Enumerating objects: 36224, done.remote: Counting objects: 100% (36224/36224), done.remote: Compressing objects: 100% (28505/28505), done.remote: Total 36224 (delta 9718), reused 17788 (delta 6426), pack-reused 0Receiving objects: 100% (36224/36224), 156.32 MiB | 8.40 MiB/s, done.Resolving deltas: 100% (9718/9718), done.Updating files: 100% (31088/31088), done.warning: the following paths have collided (e.g. case-sensitive pathson a case-insensitive filesystem) and only one from the samecolliding group is in the working tree:'doc/cla/individual/PallaviSrivastavaa.md''doc/cla/individual/pallavisrivastavaa.md'
1分多钟,大概1个G的代码干完了。
2、配置运行环境
打开conda,建了一个python12的虚拟环境,在vscode里指定了该环境,打开终端,结果激活虚拟环境失败
PS C:\Users\Administrator> conda activate py311usage: conda-script.py [-h] [--no-plugins] [-V] COMMAND ...conda-script.py: error: argument COMMAND: invalid choice: 'activate' (choose from 'clean', 'compare', 'config', 'create', 'info', 'init', 'install', 'list', 'notices', 'package', 'remove', 'uninstall', 'rename', 'run', 'search', 'update', 'upgrade', 'build', 'convert', 'debug', 'develop', 'doctor', 'index', 'inspect', 'metapackage', 'render', 'skeleton', 'pack', 'content-trust', 'verify', 'token', 'env', 'repo', 'server')
解决方案如下:
用管理员打开power shell,执行下面两条命令
PS C:\WINDOWS\system32> Set-ExecutionPolicy RemoteSignedPS C:\WINDOWS\system32> conda init powershell
然后在vscode里重新打开终端, ok
(base) PS D:\BaiduSyncdisk\odoo\odoo17> activate(base) PS D:\BaiduSyncdisk\odoo\odoo17> conda activate py312(py312) PS D:\BaiduSyncdisk\odoo\odoo17>
3、安装依赖
pip install -r .\requirements.txt
python12已经发布,本来想尝尝鲜,结果用python12的虚拟环境安装上面的依赖报错,果断换回了python11,就没有问题了。
4、配置文件
从odoo16拷贝了一个配置文件,odoo.conf, db_name 改成odoo17
[options]addons_path = addons,third_addons,myaddonsdb_host = 127.0.0.1db_port = 5432db_name = odoo17db_user = odoodb_password = odooload_language = zh_CNlog_level = infoadmin_passwd =adminhttp_port = 8017
5、启动文件
直接从16拷贝过来的,name改成”odoo17-run”
{// 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"name":"Python: 当前文件","type":"python","request":"launch","program":"${file}","console":"integratedTerminal","justMyCode":true},{"name": "odoo17-run","type": "python","python": "${command:python.interpreterPath}","request": "launch", // launch 启动程序attach调试程序"program": "${workspaceFolder}/odoo-bin","console": "integratedTerminal","justMyCode": false,"args": ["-c","${workspaceFolder}/odoo.conf", "--dev=xml"]//,"-u","hx_hr,hx_gift,estate","--dev=xml"}]}
6 运行odoo17-run
(base) PS D:\BaiduSyncdisk\odoo\odoo17> activate(base) PS D:\BaiduSyncdisk\odoo\odoo17> conda activate py311(py311) PS D:\BaiduSyncdisk\odoo\odoo17>& 'D:\ProgramData\anaconda3\envs\py311\python.exe' 'c:\Users\Administrator\.vscode\extensions\ms-python.python-2023.20.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '49719' '--' 'D:\BaiduSyncdisk\odoo\odoo17/odoo-bin' '-c' 'D:\BaiduSyncdisk\odoo\odoo17/odoo.conf' '--dev=xml' 2023-11-11 01:28:43,586 17208 INFO ? odoo: Odoo version 17.0 2023-11-11 01:28:43,587 17208 INFO ? odoo: Using configuration file at D:\BaiduSyncdisk\odoo\odoo17\odoo.conf 2023-11-11 01:28:43,587 17208 INFO ? odoo: addons paths: ['D:\\BaiduSyncdisk\\odoo\\odoo17\\odoo\\addons', 'c:\\users\\administrator\\appdata\\local\\openerp s.a\\odoo\\addons\\17.0', 'd:\\baidusyncdisk\\odoo\\odoo17\\addons', 'd:\\baidusyncdisk\\odoo\\odoo17\\third_addons', 'd:\\baidusyncdisk\\odoo\\odoo17\\myaddons', 'd:\\baidusyncdisk\\odoo\\odoo17\\odoo\\addons'] 2023-11-11 01:28:43,588 17208 INFO ? odoo: database: odoo@127.0.0.1:5432 2023-11-11 01:28:45,345 17208 INFO ? odoo.addons.base.models.ir_actions_report: You need Wkhtmltopdf to print a pdf version of the reports. 2023-11-11 01:28:46,245 17208 INFO ? odoo.modules.loading: init db 2023-11-11 01:28:47,156 17208 INFO ? odoo.service.server: HTTP service (werkzeug) running on LAPTOP-AV3CF7SO:8017
大功告成,打开地址http://127.0.0.1:8017/ ,好像跟16也沒啥大变化。
输入默认的用户名和密码admin/admin,登陆系统,UI是不一样了