Set default keyword for action triggered by button

issue6302
review33871002
This commit is contained in:
Cédric Krier committed 2017-03-13 20:35:17 +01:00
1 parent a4b7b74e51
commit 71a4f45265
2 files changed
+9 -2

No files matched your search

+8 -1
View File
@@ -53,7 +53,7 @@ class Action(object):
return True
@staticmethod
def execute(act_id, data, action_type=None, context=None):
def execute(act_id, data, action_type=None, context=None, keyword=False):
# Must be executed synchronously to avoid double execution
# on double click.
if not action_type:
@@ -63,6 +63,13 @@ class Action(object):
action, = RPCExecute('model', action_type, 'search_read',
[('action', '=', act_id)], 0, 1, None, None,
context=context)
if keyword:
keywords = {
'ir.action.report': 'form_report',
'ir.action.wizard': 'form_action',
'ir.action.act_window': 'form_relate',
}
action.setdefault('keyword', keywords.get(action_type, ''))
Action._exec_action(action, data, context=context)
@staticmethod
+1 -1
View File
@@ -1086,7 +1086,7 @@ class Screen(SignalEvent):
'model': self.model_name,
'id': self.current_record.id,
'ids': ids,
}, context=self.context)
}, context=self.context, keyword=True)
def client_action(self, action):
access = MODELACCESS[self.model_name]