Some checks failed
odoo-restore-open_workshop-install / run-odoo-backup-in-docker (push) Failing after 4m47s
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
# scripts/uninstall_vvow_einweisungen.py
|
|
# Auszug aus der gitea action:
|
|
'''
|
|
- name: Uninstall vvow_einweisungen
|
|
run: |
|
|
docker exec hobbyhimmel_odoo_${{ env.CONTAINER_NAME_EXTENSION }} /bin/bash -c "
|
|
cd /home/odoo/custom_addons/open_workshop/scripts && \
|
|
/opt/odoo/odoo/odoo-bin shell -d ${{ env.DB_NAME }} < uninstall_vvow_einweisungen.py"
|
|
docker restart hobbyhimmel_odoo_${{ env.CONTAINER_NAME_EXTENSION }}
|
|
|
|
'''
|
|
|
|
|
|
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() |