Skip to content

[IMP] server_environment: module uninstallation#261

Open
gurneyalex wants to merge 3 commits into
OCA:18.0from
camptocamp:18.0-server_environment_uninstall_helper
Open

[IMP] server_environment: module uninstallation#261
gurneyalex wants to merge 3 commits into
OCA:18.0from
camptocamp:18.0-server_environment_uninstall_helper

Conversation

@gurneyalex
Copy link
Copy Markdown
Member

Add a helper to manage the restoring of the database columns when a module using server_environment is uninstalled or the dependency on server_environment is dropped.

Document how to use the helper in an uninstall script or in an upgrade script (if a new version of the addon drops the dependency).

Add a helper to manage the restoring of the database columns when a
module using `server_environment` is uninstalled or the dependency on
`server_environment` is dropped.

Document how to use the helper in an uninstall script or in an upgrade
script (if a new version of the addon drops the dependency).
@gurneyalex gurneyalex force-pushed the 18.0-server_environment_uninstall_helper branch from 0ecea77 to 398d5b1 Compare April 1, 2026 11:44
@gurneyalex gurneyalex marked this pull request as ready for review May 22, 2026 12:54
@OCA-git-bot OCA-git-bot added series:18.0 mod:server_environment Module server_environment labels Jun 4, 2026
@twalter-c2c
Copy link
Copy Markdown

twalter-c2c commented Jun 4, 2026

Hello @gurneyalex. Thank you for your work! I did some tests on my side. I suggested a fixup, since I was not falling into the fallback logic because no processed field was required. I believe that is because we set all fields as not required in the _server_env_transform_field_to_read_from_env method. Feel free to squash, drop or update my fixup commit, based on your judgement. Or please let me know in case I should take over.

Copy link
Copy Markdown
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

minor remark

return

@api.model
def restore_env_managed_columns(self, model_name, field_names, field_defaults=None):
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.

as it only needs a cursor I would move this to a utils.py function

# your_addon/__init__.py
from . import models

def uninstall_hook(env):
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.

better in a hooks.py file

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.

5 participants