[FIX] Base: Remove invalid User-Defined Filters

closes odoo/odoo#156622

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
This commit is contained in:
Daryl Chen
2024-03-12 11:55:40 +00:00
parent 078bf75f1d
commit 9967a5cb99
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -15,3 +15,4 @@ List of contributors:
Daniel Dico ddico@oerp.ca https://github.com/ddico
Yash Pathak yp@oerp.ca https://github.com/yp-oerp
Lucas Jagel lj@oerp.ca https://github.com/lj-oerp
Daryl Chen dc@oerp.ca https://github.com/dc-oerp
+3 -1
View File
@@ -86,10 +86,12 @@ class IrActions(models.Model):
return res
def unlink(self):
"""unlink ir.action.todo which are related to actions which will be deleted.
"""unlink ir.action.todo/ir.filters which are related to actions which will be deleted.
NOTE: ondelete cascade will not work on ir.actions.actions so we will need to do it manually."""
todos = self.env['ir.actions.todo'].search([('action_id', 'in', self.ids)])
todos.unlink()
filters = self.env['ir.filters'].search([('action_id', 'in', self.ids)])
filters.unlink()
res = super(IrActions, self).unlink()
# self.get_bindings() depends on action records
self.env.registry.clear_cache()