Skip to content

Commit 7c1970e

Browse files
committed
[ADD] cetmix_tower_jet_isolation: add uninstall hook to reset isolation data
When the module is uninstalled Odoo does not drop the columns it added to cx.tower.jet.template, so existing records may keep isolation_mode=True and silently continue to restrict commands/plans even with the module gone. The new uninstall_hook resets all isolation-related fields to their neutral state (isolation_mode=False, forced_applicability=False, both tag M2M cleared) on every jet template before the module is removed from the registry. * hooks.py - new file with uninstall_hook function * __init__.py - import hooks so Odoo can resolve the hook entry point * __manifest__.py - register uninstall_hook key
1 parent 1028b27 commit 7c1970e

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
from . import models
2-
from . import wizards
1+
from . import hooks, models, wizards

cetmix_tower_jet_isolation/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
],
1616
"installable": True,
1717
"license": "AGPL-3",
18+
"uninstall_hook": "uninstall_hook",
1819
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
def uninstall_hook(env):
2+
"""Reset isolation fields on all jet templates when the module is uninstalled.
3+
4+
Odoo does not drop columns when a module is uninstalled, so any templates
5+
that had ``isolation_mode`` enabled would still carry the value ``True``
6+
in their row. When the module is re-installed (or the column is somehow
7+
still read) those stale values would silently reactivate the restriction
8+
logic. Resetting them here ensures a clean state.
9+
"""
10+
env["cx.tower.jet.template"].search([("isolation_mode", "=", True)]).write(
11+
{
12+
"isolation_mode": False,
13+
"forced_applicability": False,
14+
"forced_command_tag_ids": [(5,)],
15+
"forced_plan_tag_ids": [(5,)],
16+
}
17+
)

0 commit comments

Comments
 (0)