Skip to content

[17.0][BKP] server_environment: Preserve not env managed data - #286

Merged
OCA-git-bot merged 2 commits into
OCA:17.0from
camptocamp:17.0-bkp-server_env_preserve
Sep 1, 2026
Merged

[17.0][BKP] server_environment: Preserve not env managed data#286
OCA-git-bot merged 2 commits into
OCA:17.0from
camptocamp:17.0-bkp-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:17.0 labels Aug 24, 2026
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 17.0.1.0.2 as next patch one release ahead of current

@yankinmax yankinmax changed the title [17.0][BKP] server_environment: Preserve not env managed data- #264 [17.0][BKP] server_environment: Preserve not env managed data #264 Aug 24, 2026
@yankinmax yankinmax changed the title [17.0][BKP] server_environment: Preserve not env managed data #264 [17.0][BKP] server_environment: Preserve not env managed data Aug 24, 2026
@yankinmax
yankinmax force-pushed the 17.0-bkp-server_env_preserve branch from 1d62f95 to e7497de Compare August 25, 2026 05:48
return

@api.model
def _preserve_not_env_managed_data(self, field_name_list):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you should bump this module's version too as we want to merge w/ nobump

@yankinmax
yankinmax force-pushed the 17.0-bkp-server_env_preserve branch from e7497de to db38d94 Compare August 31, 2026 06:18
…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 17.0-bkp-server_env_preserve branch from db38d94 to 55fcfaf Compare August 31, 2026 06:22
@simahawk

simahawk commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

/ocabot merge nobump

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 17.0-ocabot-merge-pr-286-by-simahawk-bump-nobump, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit dc9fc93 into OCA:17.0 Sep 1, 2026
5 of 7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 74286d4. Thanks a lot for contributing to OCA. ❤️

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants