Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
7918 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 23
3067
2
ส.ค. 15
10643
0
พ.ค. 15
4265
0
เม.ย. 15
4748
0
ก.ย. 23
5377