Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
19021 Lượt xem

Hi

There is a custom_addons folder and there is no __init__.py file in it. There are two separate modules, lets say - module_one and module_two . In module_one there is a py file which I need in module_two to get a declared global variable.

Now when I write:

from odoo.addons.module_one import model

It shows error and doesn't find the module, because the module_one isn't in addons folder. I can't add __init__.py in the custom addons folder due to some restrictions. 

How can I get the custom modules py file in another custom module?

Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

It worked with: 

from odoo.addons.custom_addon_name.models.py_file_name import IMPORT_LIST

It looks like IDE was conning with me.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
7
thg 12 23
27066
1
thg 3 15
10157
2
thg 10 23
4129
1
thg 1 23
6457
0
thg 9 17
5421