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

How do I get to use a constant defined in some other module?


Suppose I want to use XPTO defined in hr_timesheet module.

The value is a constant. It's not within a class


How do I refer to it in my own module?


;)

الصورة الرمزية
إهمال
الكاتب

from odoo.addons.[MODULE].[FILE] import [var1], [var2]

أفضل إجابة

Hi Rui Franco,

Try below code in a python file of your module:

 from odoo.addons.hr_timesheet.models.[file name] import XPTO

 This will import XPTO variable of hr_timesheet module into your file

Hope this will help you!

Thanks

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يوليو 23
2744
2
أغسطس 15
10323
0
مايو 15
3996
0
أبريل 15
4468
0
سبتمبر 23
5131