Add reference to the type of action in action

This commit is contained in:
Cédric Krier committed 2023-06-23 14:03:45 +02:00
1 parent 920d841ffa
commit 2ac7600b3d
2 files changed
+21 -11

No files matched your search

+16 -7
View File
@@ -46,18 +46,23 @@ class ContextError(ValidationError):
EMAIL_REFKEYS = set(('cc', 'to', 'subject'))
ACTION_SELECTION = [
('ir.action.report', "Report"),
('ir.action.act_window', "Window"),
('ir.action.wizard', "Wizard"),
('ir.action.url', "URL"),
]
class Action(DeactivableMixin, ModelSQL, ModelView):
"Action"
__name__ = 'ir.action'
name = fields.Char('Name', required=True, translate=True)
type = fields.Selection([
('ir.action.report', "Report"),
('ir.action.act_window', "Window"),
('ir.action.wizard', "Wizard"),
('ir.action.url', "URL"),
], "Type", required=True, readonly=True)
type = fields.Selection(
ACTION_SELECTION, "Type", required=True, readonly=True)
action = fields.Function(
fields.Reference("Action", selection=ACTION_SELECTION),
'get_action')
records = fields.Selection([
('selected', "Selected"),
('listed', "Listed"),
@@ -75,6 +80,9 @@ class Action(DeactivableMixin, ModelSQL, ModelView):
'get_action_value': RPC(instantiate=0, cache=dict(days=1)),
})
def get_action(self, name):
return f'{self.type},{self.id}'
@classmethod
def default_records(cls):
return 'selected'
@@ -309,7 +317,8 @@ class ActionMixin(ModelSQL):
_action_name = 'name'
action = fields.Many2One(
'ir.action', "Action", required=True, ondelete='CASCADE')
'ir.action', "Action",
required=True, readonly=True, ondelete='CASCADE')
@classmethod
def __setup__(cls):
+5 -4
View File
@@ -10,14 +10,15 @@ this repository contains the full copyright notices and license terms. -->
</group>
<notebook colspan="4">
<page string="General" id="general">
<label name="type"/>
<field name="type"/>
<label name="action"/>
<field name="action"/>
<label name="icon"/>
<field name="icon"/>
<label name="records"/>
<field name="records"/>
<label name="usage"/>
<field name="usage"/>
<label name="icon"/>
<field name="icon"/>
</page>
<page name="keywords">
<field name="keywords" colspan="4"/>