Skip to content

[16.0][FIX] contract_forecast: Removed default values from related fields in res.config.settings#1434

Open
Honeyxilia wants to merge 1 commit into
OCA:16.0from
commown:16.0-fix-contract_forecast-default_res_config_settings_values
Open

[16.0][FIX] contract_forecast: Removed default values from related fields in res.config.settings#1434
Honeyxilia wants to merge 1 commit into
OCA:16.0from
commown:16.0-fix-contract_forecast-default_res_config_settings_values

Conversation

@Honeyxilia
Copy link
Copy Markdown

@Honeyxilia Honeyxilia commented May 20, 2026

Opening the Settings menu instanciates a new res.config.settings object, then applies the assigned values to revelant fields once we use the Save action.

The related field on these fields are intended to fetch the company values, then to apply the saved values to the related field afterwards. However, the assignment of default values on these fields means that, when creating a new res.config.settings instance, these default values are used, and then inversely applied to the related fields, meaning that if we are to use the Save action (which can happen if we quit the view), the default values always override the company values, unless we always go out of our way to the Invoicing tab and set the contract_forecast values to the desired values.

As such, we remove these default attributes, so that the res.config.settings instance doesn't override the company values whenever we open the Settings menu.

Steps to reproduce the bug:

  1. Create a v16 instance of Odoo, with contract_forecast installed.
  2. Go into the Settings menu
  3. Go into the Invoicing tab and go to the Contract section
  4. Set one of the Contract forecast to a different value (ie. disable Contract forecast, or set the forecast to 6 years)
  5. Use the Save action
  6. Go back to the Invoicing tab -> Contract section : the values will be reset to default

…n res.config.settings

Opening the Configuration menu instanciates a new res.config.settings object, then applies the assigned values to revelant fields once we use the Save action.

The related field on these fields are intended to fetch the company values, then to apply the saved values to the related field afterwards.
However, the assignment of default values on these fields means that, when creating a new res.config.settings instance, these default values are used,
and then inversely applied to the related fields, meaning that if we are to use the Save action (which can happen if we quit the view), the default values
always override the company values, unless we always go out of our way to the Invoicing tab and set the contract_forecast values to the desired values.

As such, we remove these default attributes, so that the res.config.settings instance doesn't override the company values whenever we open the Configuration menu.
@Honeyxilia Honeyxilia changed the title [FIX] contract_forecast: Removed default values from related fields in res.config.settings [16.0][FIX] contract_forecast: Removed default values from related fields in res.config.settings May 20, 2026
Copy link
Copy Markdown

@maisim maisim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults already are on res.company :

https://github.com/OCA/contract/blob/16.0/contract_forecast/models/res_company.py#L10-L18

So removing them from the res.config.settings sound good. Existing company values are preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants