From a38fc477f52b8ca4db478a63c5a1b748973d671e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 27 Aug 2024 00:16:24 +0200 Subject: [PATCH] Remove sequence order on menu favorite Instead we order the favorites of a user by descending id. Such that the last favorite set is the first from the list. So user can put a favorite back on top by unset a menu and set it again. --- trytond/trytond/ir/ui/menu.py | 5 +++-- trytond/trytond/ir/view/ui_menu_favorite_form.xml | 2 -- trytond/trytond/ir/view/ui_menu_favorite_list.xml | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/trytond/trytond/ir/ui/menu.py b/trytond/trytond/ir/ui/menu.py index c21f416f3e..fb81f09fcd 100644 --- a/trytond/trytond/ir/ui/menu.py +++ b/trytond/trytond/ir/ui/menu.py @@ -262,7 +262,7 @@ class UIMenu( return menu2favorite -class UIMenuFavorite(sequence_ordered(), ModelSQL, ModelView): +class UIMenuFavorite(ModelSQL, ModelView): "Menu Favorite" __name__ = 'ir.ui.menu.favorite' @@ -289,7 +289,8 @@ class UIMenuFavorite(sequence_ordered(), ModelSQL, ModelView): user = Transaction().user favorites = cls.search([ ('user', '=', user), - ]) + ], + order=[('id', 'DESC')]) return [(f.menu.id, f.menu.rec_name, f.menu.icon) for f in favorites] @classmethod diff --git a/trytond/trytond/ir/view/ui_menu_favorite_form.xml b/trytond/trytond/ir/view/ui_menu_favorite_form.xml index 80117401f8..c0eb11289a 100644 --- a/trytond/trytond/ir/view/ui_menu_favorite_form.xml +++ b/trytond/trytond/ir/view/ui_menu_favorite_form.xml @@ -4,8 +4,6 @@ this repository contains the full copyright notices and license terms. -->