Skip to content

Commit 7d5a89d

Browse files
committed
[FIX] util/modules: remove server acts after crons
During module uninstall we might encounter a fkey constraint 'ir_cron_ir_actions_server_id_fkey' that prevents the removal of the module's server action records. Ideally, the cron is removed before the actions thanks to the select xmlids and order by id, but in older versions there was no server action and they were created in 10.saas~14 for all existing crons. Part of odoo/upgrade#5308 Signed-off-by: Christophe Simonis (chs) <[email protected]>
1 parent 37abe60 commit 7d5a89d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/util/modules.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def uninstall_module(cr, module):
108108
)
109109

110110
# delete data
111-
model_ids, field_ids, menu_ids = [], [], []
111+
model_ids, field_ids, menu_ids, server_action_ids = [], [], [], []
112112
cr.execute(
113113
"""
114114
SELECT model, res_id
@@ -133,6 +133,8 @@ def uninstall_module(cr, module):
133133
field_ids.append(res_id)
134134
elif model == "ir.ui.menu":
135135
menu_ids.append(res_id)
136+
elif model == "ir.actions.server":
137+
server_action_ids.append(res_id)
136138
else:
137139
to_group.append((model, res_id))
138140

@@ -142,6 +144,8 @@ def uninstall_module(cr, module):
142144
remove_view(cr, view_id=res_id, silent=True)
143145
else:
144146
remove_records(cr, model, [it[1] for it in group])
147+
if server_action_ids:
148+
remove_records(cr, "ir.actions.server", server_action_ids)
145149

146150
if menu_ids:
147151
remove_menus(cr, menu_ids)

0 commit comments

Comments
 (0)