From 328a8c822ecd0fb7c2de14031d9193ba77d7013d Mon Sep 17 00:00:00 2001 From: Quoc - Pham Ngoc Date: Wed, 15 Jul 2026 21:37:35 +0700 Subject: [PATCH] [IMP] database_cleanup: Purge menu has action that does not exist or has been deleted --- database_cleanup/wizards/purge_menus.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/database_cleanup/wizards/purge_menus.py b/database_cleanup/wizards/purge_menus.py index be3d529df25..50118be8468 100644 --- a/database_cleanup/wizards/purge_menus.py +++ b/database_cleanup/wizards/purge_menus.py @@ -4,6 +4,7 @@ # pylint: disable=consider-merging-classes-inherited from odoo import api, fields, models from odoo.exceptions import UserError +from odoo.fields import Command class CleanupPurgeWizardMenu(models.TransientModel): @@ -22,19 +23,15 @@ def find(self): .with_context(active_test=False) .search([("action", "!=", False)]) ): + command = Command.create({"name": menu.complete_name, "menu_id": menu.id}) + if not menu.action.exists(): + # Menus may have actions that do not exist or have been deleted + res.append(command) + continue if menu.action.type != "ir.actions.act_window": continue if menu.action.res_model and menu.action.res_model not in self.env: - res.append( - ( - 0, - 0, - { - "name": menu.complete_name, - "menu_id": menu.id, - }, - ) - ) + res.append(command) if not res: raise UserError(self.env._("No dangling menu entries found")) return res