[ADD] support for server actions
bzr revid: xmo@openerp.com-20110630062424-gmnlahmexklnftbk
This commit is contained in:
parent
ef3a71fec3
commit
3cd6c86f87
|
@ -286,15 +286,11 @@ def fix_view_modes(action):
|
||||||
if action.pop('view_type') != 'form':
|
if action.pop('view_type') != 'form':
|
||||||
return
|
return
|
||||||
|
|
||||||
if 'view_mode' in action:
|
action['views'] = [
|
||||||
action['view_mode'] = ','.join(
|
[id, mode if mode != 'tree' else 'list']
|
||||||
mode if mode != 'tree' else 'list'
|
for id, mode in action['views']
|
||||||
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']
|
|
||||||
]
|
|
||||||
return action
|
return action
|
||||||
|
|
||||||
class Menu(openerpweb.Controller):
|
class Menu(openerpweb.Controller):
|
||||||
|
@ -774,3 +770,8 @@ class Action(openerpweb.Controller):
|
||||||
if action:
|
if action:
|
||||||
value = clean_action(action[0], req.session)
|
value = clean_action(action[0], req.session)
|
||||||
return {'result': value}
|
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)
|
||||||
|
|
|
@ -73,6 +73,14 @@ openerp.base.ActionManager = openerp.base.Controller.extend({
|
||||||
dialog.$element.dialog('destroy');
|
dialog.$element.dialog('destroy');
|
||||||
dialog.stop();
|
dialog.stop();
|
||||||
break;
|
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:
|
default:
|
||||||
console.log("Action manager can't handle action of type " + action.type, action);
|
console.log("Action manager can't handle action of type " + action.type, action);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue