Make the user menu favorites unique

Closes #14213
This commit is contained in:
Cédric Krier
2026-01-16 10:07:03 +01:00
parent 0d4ec58be9
commit 947a63c456
+3 -2
View File
@@ -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 @@ class UIMenuFavorite(ModelSQL):
('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):