Skip to content
Advertisement

Value of custom field in sale.config.settings is not displayed in sales settings view

I try to add a new configuration field for sales configuration settings by inheriting the standard sales settings view/model using a custom module.

Creating the field in the model works fine and a value entered in the view is also successfully written to the database. However, if I reload the view for sales configuration, the previously stored value is back to 0.00 (while still being ok in the table!).

Struggling with this for days now, found related posts by research (odoo site and stackoverflow) which all unfortunately did not work for me.

This is the view definition XML file:

JavaScript

This is the Python code:

JavaScript

By debugging I also found, that the function get_default_threshold_price_mgr_sig is never executed…

I know that configuration settings fields works different than normal fields – just can’t figure out how.

Do you know, what I am doing wrong?

Advertisement

Answer

Base configuration wizard for application settings. It provides support for setting default values, assigning groups to employee users, and installing modules. To make such a ‘settings’ wizard, define a model like::

JavaScript

The method execute provides some support based on a naming convention:

JavaScript

The method get_default retrieves values that reflect the current status of the fields like ‘default_XXX’, ‘group_XXX’ and ‘module_XXX’. It also invokes all methods with a name that starts with ‘get_default_’; such methods can be defined to provide current values for other fields.

The config page works because when you open the configuration page all the “get_” functions will be called. And when you save it all the “set_” functions are going to run.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement