Skip to content

[19.0][FWP] server_environment: Preserve not env managed data - #288

Open
yankinmax wants to merge 2 commits into
OCA:19.0from
camptocamp:19.0-fwp-server_env_preserve
Open

[19.0][FWP] server_environment: Preserve not env managed data#288
yankinmax wants to merge 2 commits into
OCA:19.0from
camptocamp:19.0-fwp-server_env_preserve

Conversation

@yankinmax

Copy link
Copy Markdown
Contributor

Helper function typically used for hooks and migration scripts.
Restores database values for fields transitioning to 'server env managed'.

When a field is defined as managed by the server environment, Odoo
ignores the value stored in the database, prioritizing the environment
configuration instead. If no environment configuration exists, the field
may effectively lose its previous value.

This method forces to 'persist' these values if they are not
explicitly overridden by the current environment configuration.
@OCA-git-bot OCA-git-bot added mod:server_environment Module server_environment mod:mail_environment Module mail_environment series:19.0 labels Aug 24, 2026
…cation"

To preserve the value of field "smtp_authentication" if we don't set it from
the environment.
Which may happen to anyone updating the sources of mail_environment for its project.
@yankinmax
yankinmax force-pushed the 19.0-fwp-server_env_preserve branch from 79b00df to 9fc049b Compare August 24, 2026 06:26
Comment on lines +7 to +9
@openupgrade.migrate()
def migrate(env, version):
env["ir.mail_server"]._preserve_not_env_managed_data(["smtp_authentication"])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Set 19.0.1.1.1 as next patch one release ahead of current.

{
"name": "Mail configuration with server_environment",
"version": "19.0.1.1.0",
"version": "19.0.1.1.1",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pre-commit argues if manifest version is not changed

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

Labels

mod:mail_environment Module mail_environment mod:server_environment Module server_environment series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants