From 92d4f0b27e7116bbbb91bbb80b952aa6d0b23f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 2 May 2013 17:23:37 +0200 Subject: [PATCH] Add button --- src/action.js | 18 ++++++++++++++++++ src/common.js | 22 ++++++++++++---------- src/model.js | 42 +++++++++++++++++++++++++++++++++++++----- src/screen.js | 32 ++++++++++++++++++++++++++++++++ src/view.js | 43 ++++++++++++++++++++++++++++++++++--------- src/wizard.js | 6 +++--- 6 files changed, 136 insertions(+), 27 deletions(-) diff --git a/src/action.js b/src/action.js index 9a896b197e..ba700340e1 100644 --- a/src/action.js +++ b/src/action.js @@ -132,6 +132,24 @@ return prm.pipe(exec_action); }; + Sao.Action.execute = function(id, data, type, context) { + if (!type) { + Sao.rpc({ + 'method': 'model.ir.action.read', + 'params': [[id], ['type'], context] + }, Sao.Session.current_session).done(function(result) { + Sao.Action.execute(id, data, result[0].type, context); + }); + } else { + Sao.rpc({ + 'method': 'model.' + type + '.search_read', + 'params': [[['action', '=', id]], 0, 1, null, null, context] + }, Sao.Session.current_session).done(function(result) { + Sao.Action.exec_action(result[0], data); + }); + } + }; + Sao.Action.evaluate = function(action, atype, record) { action = jQuery.extend({}, action); switch (atype) { diff --git a/src/common.js b/src/common.js index 1b195f0e81..7cdd842aa5 100644 --- a/src/common.js +++ b/src/common.js @@ -191,15 +191,17 @@ } }; - Sao.common.Button = function(attributes) { - var button = jQuery('