From 6e33fed3b50194fa1e816deab44c3572a5ef1e3d Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 6 Dec 2011 18:31:42 +0100 Subject: [PATCH] [ADD] Add support for custom arguments in View#do_execute_action bzr revid: fme@openerp.com-20111206173142-4z2ysaqf456zbcig --- addons/web/static/src/js/views.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index f681bc78747..db64865c266 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -909,7 +909,19 @@ session.web.View = session.web.Widget.extend(/** @lends session.web.View# */{ if (action_data.special) { return handler({result: {"type":"ir.actions.act_window_close"}}); } else if (action_data.type=="object") { - return dataset.call_button(action_data.name, [[record_id], context], handler); + var args = [[record_id]], additional_args = []; + if (action_data.args) { + try { + // Warning: quotes and double quotes problem due to json and xml clash + // Maybe we should force escaping in xml or do a better parse of the args array + additional_args = JSON.parse(action_data.args.replace(/'/g, '"')); + args = args.concat(additional_args); + } catch(e) { + console.error("Could not JSON.parse arguments", action_data.args); + } + } + 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); } else {