Replace action of menu by a filtered list of action keywords
This commit is contained in:
@@ -97,8 +97,11 @@ class UIMenu(
|
||||
('ir.action.wizard', 'ir.action.wizard'),
|
||||
('ir.action.url', 'ir.action.url'),
|
||||
], translate=False), 'get_action', setter='set_action')
|
||||
action_keywords = fields.One2Many('ir.action.keyword', 'model',
|
||||
'Action Keywords')
|
||||
action_keywords = fields.One2Many(
|
||||
'ir.action.keyword', 'model', "Action Keywords",
|
||||
filter=[
|
||||
('keyword', '=', 'tree_open'),
|
||||
])
|
||||
favorite = fields.Function(fields.Boolean('Favorite'), 'get_favorite')
|
||||
|
||||
@classmethod
|
||||
@@ -126,7 +129,7 @@ class UIMenu(
|
||||
for record in cls.search([
|
||||
('rec_name', 'ilike', '%%%s%%' % text),
|
||||
]):
|
||||
if record.action:
|
||||
if record.action_keywords:
|
||||
yield record, record.rec_name, record.icon
|
||||
|
||||
@classmethod
|
||||
@@ -226,8 +229,8 @@ class UIMenu(
|
||||
('menu', 'in', [m.id for m in menus]),
|
||||
('user', '=', user),
|
||||
])
|
||||
menu2favorite = dict((m.id, False if m.action else None)
|
||||
for m in menus)
|
||||
menu2favorite = {
|
||||
m.id: False if m.action_keywords else None for m in menus}
|
||||
menu2favorite.update(dict((f.menu.id, True) for f in favorites))
|
||||
return menu2favorite
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<form col="2">
|
||||
<label name="action"/>
|
||||
<field name="action"/>
|
||||
<newline/>
|
||||
|
||||
<label name="model"/>
|
||||
<field name="model"/>
|
||||
|
||||
<label name="keyword"/>
|
||||
<field name="keyword"/>
|
||||
</form>
|
||||
|
||||
@@ -6,15 +6,17 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name"/>
|
||||
<label name="active"/>
|
||||
<field name="active"/>
|
||||
|
||||
<label name="parent"/>
|
||||
<field name="parent"/>
|
||||
<newline/>
|
||||
|
||||
<label name="icon"/>
|
||||
<field name="icon"/>
|
||||
<label name="action"/>
|
||||
<field name="action"/>
|
||||
<label name="sequence"/>
|
||||
<field name="sequence"/>
|
||||
<label name="complete_name"/>
|
||||
<field name="complete_name" colspan="3"/>
|
||||
|
||||
<field name="action_keywords" string="Actions" colspan="4"/>
|
||||
|
||||
<field name="groups" colspan="4"/>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user