details: https://code.tryton.org/tryton/commit/47972067b970
branch: default
user: Cédric Krier <[email protected]>
date: Fri Jan 16 10:07:03 2026 +0100
description:
Make the user menu favorites unique
Closes #14213
diffstat:
trytond/trytond/ir/ui/menu.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r be8361417ecf -r 47972067b970 trytond/trytond/ir/ui/menu.py
--- a/trytond/trytond/ir/ui/menu.py Sat Jan 24 19:25:47 2026 +0100
+++ b/trytond/trytond/ir/ui/menu.py Fri Jan 16 10:07:03 2026 +0100
@@ -1,6 +1,6 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
-from collections import defaultdict
+from collections import OrderedDict, defaultdict
from itertools import groupby
from trytond.model import (
@@ -306,7 +306,8 @@
('user', '=', user),
],
order=[('id', 'DESC')])
- return [(f.menu.id, f.menu.rec_name, f.menu.icon) for f in favorites]
+ return list(OrderedDict.fromkeys(
+ (f.menu.id, f.menu.rec_name, f.menu.icon) for f in favorites))
@classmethod
def set(cls, menu_id):