diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 412ea9abda2..c559758d3f2 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1494,10 +1494,6 @@ class Binary(openerpweb.Controller): class Action(openerpweb.Controller): _cp_path = "/web/action" - - action_mapping = { - "ir.actions.act_url": "ir.actions.url", - } # For most actions, the type attribute and the model name are the same, but # there are exceptions. This dict is used to remap action type attributes @@ -1511,6 +1507,17 @@ class Action(openerpweb.Controller): Actions = req.session.model('ir.actions.actions') value = False context = req.session.eval_context(req.context) + + try: + action_id = int(action_id) + except ValueError: + try: + module, xmlid = action_id.split('.', 1) + model, action_id = req.session.model('ir.model.data').get_object_reference(module, xmlid) + assert model.startswith('ir.actions.') + except Exception: + action_id = 0 # force failed read + base_action = Actions.read([action_id], ['type'], context) if base_action: ctx = {} diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index e4d543c69ce..67d029953a1 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -667,7 +667,7 @@ instance.web.Menu = instance.web.Widget.extend({ * @param {Number} id the action_id to match */ open_action: function (id) { - var $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id=' + id + ']'); + var $menu = this.$element.add(this.$secondary_menus).find('a[data-action-id="' + id + '"]'); var menu_id = $menu.data('menu'); if (menu_id) { this.open_menu(menu_id); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 1bfd7d18776..1d212daaa20 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -178,7 +178,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ }); }, do_action: function(action, on_close) { - if (_.isNumber(action)) { + if (_.isNumber(action) || _.isString(action)) { var self = this; return self.rpc("/web/action/load", { action_id: action }, function(result) { self.do_action(result.result, on_close); @@ -1261,7 +1261,7 @@ instance.web.View = instance.web.Widget.extend({ args.push(context); return dataset.call_button(action_data.name, args, handler); } else if (action_data.type=="action") { - return this.rpc('/web/action/load', { action_id: parseInt(action_data.name, 10), context: context, do_not_eval: true}, handler); + return this.rpc('/web/action/load', { action_id: action_data.name, context: context, do_not_eval: true}, handler); } else { return dataset.exec_workflow(record_id, action_data.name, handler); }