跳至內容
選單
此問題已被標幟
2 回覆
7908 瀏覽次數

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
7月 23
3060
2
8月 15
10636
0
5月 15
4263
0
4月 15
4748
0
9月 23
5376