Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
7939 Zobrazení

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?


;)

Avatar
Zrušit
Autor

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

Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
čvc 23
3081
2
srp 15
10652
0
kvě 15
4269
0
dub 15
4751
0
zář 23
5382