Odoo——将自定义路径加到addons路径中时error: option --addons-path: The addons-path '/home/User_name/custom-addons'

这是stackflow里的解答

There is two way to add custom folder to the odoo addons path:
First the easy one
to edit the configuration file of the odoo server and locate the line starting with addons_path and appending comma followed by the absolute path to the directory you want to add to the addons path,
so if the custom addons directory is /home/user_name/new-addons and the path of your odoo instance is /home/user_name/odoo the line should be like this

 addons_path = /home/user_name/odoo/openerp/addons,/home/user_name/odoo/addons,/home/user_name/new-addons

The second
is when calling the odoo.py script and pass the --addons-path command line argument to it like this

$ odoo/odoo.py --addons-path="/home/user_name/odoo/openerp/addons, /home/user_name/odoo/addons, /home/user_name/new-addons"

in this case you must not only pass the path to your custom addons directory but also the paths of the base addons (odoo/openerp/addons) and the core addons directory (odoo/addons) and if your put space after the commas between the paths you will need to quote the list of directories.
here you can use relative paths but it is relative to the place where you call the odoo.py file .
if you use the second way the custom addons directory has to have at least one working module in it or any directory with init.py and openerp.py files inside it or it will give you “does not seem to a be a valid Addons Directory” error
see section : Configuring the addons path in the “Odoo Development Cookbook” book

https://stackoverflow.com/questions/38670514/how-to-add-a-custom-folder-to-odoo-py-addons-addons

具体解决步骤

001、odoo-bin: error: option –addons-path: The addons-path ‘custom-addons’ does not seem to a be a valid Addons Directory!
此报错因custom-addons中没有任何模块,可以添加模块,或加入基础代码,如进入custom-addons目录

mkdir my_module
touch my_module/__init__.py
vim my_module/__manifest__.py
# 添加如下内容并保存
{'title':'My module'}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值