Add uninstall old modules script
This commit is contained in:
parent
8ccfebb399
commit
67361724a6
23
scripts/uninstall_old_modules.py
Normal file
23
scripts/uninstall_old_modules.py
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# scripts/uninstall_old_modules.py
|
||||||
|
# odoo-bin shell -d deine_datenbank -i open_workshop --load-script=scripts/uninstall_old_modules.py
|
||||||
|
from odoo import api, SUPERUSER_ID
|
||||||
|
from odoo.modules.registry import Registry
|
||||||
|
|
||||||
|
modules_to_uninstall = [
|
||||||
|
'vvow_pos'
|
||||||
|
]
|
||||||
|
|
||||||
|
with api.Environment.manage():
|
||||||
|
registry = Registry("__db__") # Wird beim Shell-Aufruf überschrieben
|
||||||
|
with registry.cursor() as cr:
|
||||||
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
|
|
||||||
|
for module_name in modules_to_uninstall:
|
||||||
|
module = env['ir.module.module'].search([('name', '=', module_name)], limit=1)
|
||||||
|
if module and module.state == 'installed':
|
||||||
|
print(f"Uninstalling module: {module_name}")
|
||||||
|
module.button_immediate_uninstall()
|
||||||
|
else:
|
||||||
|
print(f"Module not found or not installed: {module_name}")
|
||||||
|
|
||||||
|
cr.commit()
|
||||||
Loading…
Reference in New Issue
Block a user