Reputation: 396
I would like to know how to declare global variable and call it in any module. In community used os.getenv(), in enterprise I've switch to this one: A Python request such as:
Set param and value,
self.env['ir.config_parameter'].sudo().set_param('global.variable', global_variable )
Get value:
global_variable = self.env['ir.config_parameter'].sudo().get_param('global.variable')
I think it is not very efficient as I will make many calls to the database, for all global variables that I have. Any tips/suggestions for improvement are welcome...
Upvotes: 0
Views: 995
Reputation: 11
Odoo.sh does not provide any way to set environment variables. There are two existing environment variables:
ODOO_STAGE (prod vs staging vs dev)
ODOO_VERSION (16.0 vs 17.0 vs 18.0)
See the FAQ for details: https://www.odoo.sh/faq?q=ODOO_STAGE
If you are using libraries or third party apps that depend on a given environment variable we recommend the system parameter approach.
Upvotes: 0