forked from alaguraj/odoo-testing-addons
Introduce Dine360 Restaurant Suite meta-module to group core modules and provide synchronized uninstallation.
This commit is contained in:
parent
1bdd27676b
commit
5d4614a833
@ -1 +1,2 @@
|
|||||||
# Meta module for Dine360 Chennora
|
# Meta module for Dine360 Chennora
|
||||||
|
from .hooks import uninstall_hook
|
||||||
|
|||||||
@ -9,7 +9,10 @@
|
|||||||
'dine360_dashboard',
|
'dine360_dashboard',
|
||||||
'dine360_restaurant',
|
'dine360_restaurant',
|
||||||
'dine360_theme_chennora',
|
'dine360_theme_chennora',
|
||||||
|
'dine360_kds',
|
||||||
|
'dine360_reservation',
|
||||||
],
|
],
|
||||||
|
'uninstall_hook': 'uninstall_hook',
|
||||||
'data': [
|
'data': [
|
||||||
'views/apps_kanban_menu.xml',
|
'views/apps_kanban_menu.xml',
|
||||||
],
|
],
|
||||||
|
|||||||
Binary file not shown.
26
addons/Dine360_Chennora/hooks.py
Normal file
26
addons/Dine360_Chennora/hooks.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
from odoo import api, SUPERUSER_ID
|
||||||
|
|
||||||
|
def uninstall_hook(cr, registry):
|
||||||
|
"""
|
||||||
|
Synchronized uninstallation: When Dine360 Restaurant Suite is uninstalled,
|
||||||
|
automatically trigger uninstallation for all its core sub-modules.
|
||||||
|
"""
|
||||||
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
|
modules_to_uninstall = [
|
||||||
|
'dine360_dashboard',
|
||||||
|
'dine360_restaurant',
|
||||||
|
'dine360_theme_chennora',
|
||||||
|
'dine360_kds',
|
||||||
|
'dine360_reservation'
|
||||||
|
]
|
||||||
|
|
||||||
|
# Search for these modules if they are installed
|
||||||
|
modules = env['ir.module.module'].search([
|
||||||
|
('name', 'in', modules_to_uninstall),
|
||||||
|
('state', '=', 'installed')
|
||||||
|
])
|
||||||
|
|
||||||
|
if modules:
|
||||||
|
# Mark modules for uninstallation
|
||||||
|
# button_immediate_uninstall will trigger the full process including registry reload
|
||||||
|
modules.button_immediate_uninstall()
|
||||||
Loading…
x
Reference in New Issue
Block a user