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

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?


;)

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 23
3074
2
thg 8 15
10647
0
thg 5 15
4267
0
thg 4 15
4751
0
thg 9 23
5379