Skip to content
Snippets Groups Projects
user avatar
Thomas Lefebvre (thle) authored
Steps to reproduce:
    - install sale_management module;
    - go to settings of sale_management and check "Automatic invoice" parameter;
    - in debug mode, we can see the template selected (do not change it);
    - save the settings;
    (This is just one example)

Issue:
    The parameter is not added to the "ir_config_parameter" table.

Cause:
    The improvement which consists in comparing the settings which one wishes to record with those which already exist in order to set the parameters which are different creates a problem.
    Indeed, the current settings are retrieved directly from the model with their default value if there is one.
    These are the values that will be used for the comparison.
    Because of this, when we want to save a parameter which is set to its default value (on first save), the logic will not notice a difference.
    Therefore, the parameter will not be saved in the "ir_config_parameter" table.

Consequence:
    In the code, when we wanted to look up the value of a parameter, if it is not saved, we use its default value instead of saving it with its default value.
    Example:
    ```
    field_example = fields.Integer(string='Example', default=1000, config_parameter='model.field_example')
    value_field_example = params.get_param('model.field_example', default=1000)

    ```
    The default value is repeated.

Solution:
    To know whether or not we add a new parameter in the "ir_config_parameter" table, we must look at what already exists in the table and not in the settings defined in the model.

opw-3057306

closes odoo/odoo#106184

X-original-commit: d881dfaaa163b409a94494e35afa2cbda7cf2aa2
Related: odoo/enterprise#34233
Signed-off-by: default avatarVictor Feyens (vfe) <vfe@odoo.com>
c6ee7a99
History

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials