2

I'm using odoo 11, and I'm trying to create a module. I added web_google_maps to the depends tag in my __manifest__.py, but I'm supposed to specify some parameters, such as: google_maps_view_api_key, google_maps_lang_localization, google_maps_region_localization, google_maps_theme.

Where can I specify them?

Smelly
  • 19
  • 2
Jaime Roman
  • 749
  • 1
  • 11
  • 26

2 Answers2

4

There is a special model in Odoo for specifying configuration/system parameters. The technical name is ir.config_parameter. You can simply create one of these parameters in an xml file as a record.

Below is an example:

<record id="google_maps_view_api_key" model="ir.config_parameter">
   <field name="key">google_maps_view_api_key</field>
   <field name="value">my value here</field>
</record>

You can access the above parameter in code with the following:

self.env['ir.config_parameter'].get_param('google_maps_view_api_key')

It works on a key, value pair methodology. The key is the parameter, value is the value of that parameter.

Alternatively, if you'd like to create them manually through the Odoo front end, you can navigate to "Settings -> Technical -> System Parameters" and create the record there.

Bhavya
  • 488
  • 3
  • 9
0

You can use post_init_hook argument in __manifest__.py file which allows you to insert your required argument at the time of installation of any app. This might be useful for you. You can refer following link: Odoo document for all the arguments in for manifest file

Keval Mehta
  • 689
  • 3
  • 28