From cedcc60890313470efaf66966092dafcea9bfd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 9 Feb 2021 00:32:18 +0100 Subject: [PATCH] Use menu name for window opened from menu issue9937 review315011002 --- CHANGELOG | 1 + trytond/ir/action.py | 15 ++++++++++++++- trytond/ir/cron.xml | 2 +- trytond/ir/sequence.xml | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9fc88d514a..34182b9c0e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Use menu name for window opened from menu * Add trigonometric functions to sqlite backend * Allow skipping user warnings globally * Add validate option to trytond-admin diff --git a/trytond/ir/action.py b/trytond/ir/action.py index 8df6839a69..f9782146ed 100644 --- a/trytond/ir/action.py +++ b/trytond/ir/action.py @@ -219,7 +219,9 @@ class ActionKeyword(ModelSQL, ModelView): @classmethod def get_keyword(cls, keyword, value): - Action = Pool().get('ir.action') + pool = Pool() + Action = pool.get('ir.action') + Menu = pool.get('ir.ui.menu') key = (keyword, tuple(value)) keywords = cls._get_keyword_cache.get(key) if keywords is not None: @@ -252,6 +254,17 @@ class ActionKeyword(ModelSQL, ModelView): for value in Action.get_action_values(type_, action_ids): value['keyword'] = keyword keywords.append(value) + if keyword == 'tree_open' and model == Menu.__name__: + menu = Menu(model_id) + if menu.parent: + for value in keywords: + if value['type'] == 'ir.action.act_window': + parent = menu.parent + if parent.name == value['name']: + parent = parent.parent + if parent: + value['name'] = ( + parent.rec_name + ' / ' + value['name']) keywords.sort(key=itemgetter('name')) cls._get_keyword_cache.set(key, keywords) return keywords diff --git a/trytond/ir/cron.xml b/trytond/ir/cron.xml index 3f81eca94e..7b1692a7d4 100644 --- a/trytond/ir/cron.xml +++ b/trytond/ir/cron.xml @@ -17,7 +17,7 @@ this repository contains the full copyright notices and license terms. --> cron_form - Scheduled Actions + Actions ir.cron diff --git a/trytond/ir/sequence.xml b/trytond/ir/sequence.xml index 702333af8f..54adabf1a6 100644 --- a/trytond/ir/sequence.xml +++ b/trytond/ir/sequence.xml @@ -83,7 +83,7 @@ this repository contains the full copyright notices and license terms. --> - Sequence Types + Types ir.action.act_window ir.sequence.type