'How to define global environment variables in Odoo enterprise?

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...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source