Use menu name for window opened from menu

issue9937
review315011002
This commit is contained in:
Cédric Krier
2021-02-09 00:32:18 +01:00
parent 6fec6444fc
commit cedcc60890
4 changed files with 17 additions and 3 deletions
+1
View File
@@ -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
+14 -1
View File
@@ -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
+1 -1
View File
@@ -17,7 +17,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">cron_form</field>
</record>
<record model="ir.action.act_window" id="act_cron_form">
<field name="name">Scheduled Actions</field>
<field name="name">Actions</field>
<field name="res_model">ir.cron</field>
<field name="context"></field>
</record>
+1 -1
View File
@@ -83,7 +83,7 @@ this repository contains the full copyright notices and license terms. -->
</record>
<record model="ir.action.act_window"
id="act_sequence_type_form">
<field name="name">Sequence Types</field>
<field name="name">Types</field>
<field name="type">ir.action.act_window</field>
<field name="res_model">ir.sequence.type</field>
</record>