added uninstall scripts
This commit is contained in:
parent
ba4bc5dc8d
commit
3b35a56ca1
|
|
@ -38,3 +38,4 @@ def fix_missing_pos_order_partners(cr, registry):
|
||||||
# Automatischer Start in odoo-bin shell
|
# Automatischer Start in odoo-bin shell
|
||||||
if 'env' in globals():
|
if 'env' in globals():
|
||||||
fix_missing_pos_order_partners(env.cr, env.registry)
|
fix_missing_pos_order_partners(env.cr, env.registry)
|
||||||
|
env.cr.commit()
|
||||||
35
scripts/uninstall_vvow_einweisungen.py
Normal file
35
scripts/uninstall_vvow_einweisungen.py
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
# scripts/uninstall_old_modules.py
|
||||||
|
# odoo-bin -d deine_datenbank -i open_workshop --load-script=scripts/uninstall_old_modules.py
|
||||||
|
|
||||||
|
'''
|
||||||
|
- name: Uninstall old modules
|
||||||
|
run: |
|
||||||
|
odoo-bin -d hobbyhimmel --load-script=scripts/uninstall_old_modules.py
|
||||||
|
|
||||||
|
- name: Install open_workshop
|
||||||
|
run: |
|
||||||
|
odoo-bin -d hobbyhimmel -u open_workshop
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
from odoo import api, SUPERUSER_ID
|
||||||
|
from odoo.modules.registry import Registry
|
||||||
|
|
||||||
|
modules_to_uninstall = [
|
||||||
|
'vvow_einweisungen'
|
||||||
|
]
|
||||||
|
|
||||||
|
with api.Environment.manage():
|
||||||
|
registry = Registry("hobbyhimmel") # 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()
|
||||||
|
|
@ -20,7 +20,7 @@ modules_to_uninstall = [
|
||||||
]
|
]
|
||||||
|
|
||||||
with api.Environment.manage():
|
with api.Environment.manage():
|
||||||
registry = Registry("__db__") # Wird beim Shell-Aufruf überschrieben
|
registry = Registry("hobbyhimmel") # Wird beim Shell-Aufruf überschrieben
|
||||||
with registry.cursor() as cr:
|
with registry.cursor() as cr:
|
||||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user