From f3f4f9925cd1b6d96de97c6e8ed05d23aedd486e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 23 Mar 2011 15:59:45 +0100 Subject: [PATCH] Remove recursive check_menu The recursion is already done with the search of parents --- trytond/ir/ui/menu.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/trytond/ir/ui/menu.py b/trytond/ir/ui/menu.py index 96ce1ebaeb..4e722030e5 100644 --- a/trytond/ir/ui/menu.py +++ b/trytond/ir/ui/menu.py @@ -123,19 +123,15 @@ class UIMenu(ModelSQL, ModelView): if query_string: return res - def check_menu(res): - if not res: - return [] + if res: menus = self.browse(res) parent_ids = [x.parent.id for x in menus if x.parent] parent_ids = self.search([ ('id', 'in', parent_ids), ]) - parent_ids = check_menu(parent_ids) - return [x.id for x in menus + res = [x.id for x in menus if (x.parent.id in parent_ids) or not x.parent] - res = check_menu(res) if count: return len(res) return res