[ADD] support for server actions

bzr revid: xmo@openerp.com-20110630062424-gmnlahmexklnftbk
This commit is contained in:
Xavier Morel 2011-06-30 08:24:24 +02:00
parent ef3a71fec3
commit 3cd6c86f87
2 changed files with 18 additions and 9 deletions

View File

@ -286,15 +286,11 @@ def fix_view_modes(action):
if action.pop('view_type') != 'form':
return
if 'view_mode' in action:
action['view_mode'] = ','.join(
mode if mode != 'tree' else 'list'
for mode in action['view_mode'].split(','))
if 'views' in action:
action['views'] = [
[id, mode if mode != 'tree' else 'list']
for id, mode in action['views']
]
action['views'] = [
[id, mode if mode != 'tree' else 'list']
for id, mode in action['views']
]
return action
class Menu(openerpweb.Controller):
@ -774,3 +770,8 @@ class Action(openerpweb.Controller):
if action:
value = clean_action(action[0], req.session)
return {'result': value}
@openerpweb.jsonrequest
def run(self, req, action_id):
return clean_action(req.session.model('ir.actions.server').run(
[action_id], req.session.eval_context(req.context)), req.session)

View File

@ -73,6 +73,14 @@ openerp.base.ActionManager = openerp.base.Controller.extend({
dialog.$element.dialog('destroy');
dialog.stop();
break;
case 'ir.actions.server':
this.rpc('/base/action/run', {
action_id: action.id,
context: {active_id: 66, active_ids: [66], active_model: 'ir.ui.menu'}
}).then(function (action) {
self.do_action(action, on_closed)
});
break;
default:
console.log("Action manager can't handle action of type " + action.type, action);
}