تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
18414 أدوات العرض

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

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

It worked with: 

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

It looks like IDE was conning with me.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
7
ديسمبر 23
26263
1
مارس 15
9641
2
أكتوبر 23
3590
1
يناير 23
5615
0
سبتمبر 17
4977