From 7c0e93c7c1eb4529c04fd679c3fec208a9906b14 Mon Sep 17 00:00:00 2001 From: Yolann Sabaux Date: Mon, 21 Feb 2022 15:33:03 +0000 Subject: [PATCH] [FIX] ir_actions: home action restriction Steps to reproduce: - define a home action for the user - delete the action in configuration > Window Action - refresh to the home page -> id not found Solution: - prevent the deletion of a window action if used as a home action OPW-2728824 closes odoo/odoo#89420 X-original-commit: b868583690d8560d3cc300b9448f0af32f41d81a Signed-off-by: yosa-odoo --- odoo/addons/base/models/ir_actions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/odoo/addons/base/models/ir_actions.py b/odoo/addons/base/models/ir_actions.py index 872c2f77443..2828595d525 100644 --- a/odoo/addons/base/models/ir_actions.py +++ b/odoo/addons/base/models/ir_actions.py @@ -66,6 +66,10 @@ class IrActions(models.Model): self.clear_caches() return res + @api.ondelete(at_uninstall=True) + def _unlink_check_home_action(self): + self.env['res.users'].with_context(active_test=False).search([('action_id', 'in', self.ids)]).sudo().write({'action_id': None}) + @api.model def _get_eval_context(self, action=None): """ evaluation context to pass to safe_eval """