password, db = operator.itemgetter(
'drop_pwd', 'drop_db')(
dict(map(operator.itemgetter('name', 'value'), fields)))
-
+
try:
if request.session.proxy("db").drop(password, db):
return True
class Action(http.Controller):
@http.route('/web/action/load', type='json', auth="user")
- def load(self, action_id, do_not_eval=False):
+ def load(self, action_id, do_not_eval=False, additional_context=None):
Actions = request.session.model('ir.actions.actions')
value = False
try:
base_action = Actions.read([action_id], ['type'], request.context)
if base_action:
- ctx = {}
+ ctx = request.context
action_type = base_action[0]['type']
if action_type == 'ir.actions.report.xml':
ctx.update({'bin_size': True})
- ctx.update(request.context)
+ if additional_context:
+ ctx.update(additional_context)
action = request.session.model(action_type).read([action_id], False, ctx)
if action:
value = clean_action(action[0])
sakey = Session().save_session_action(action)
debug = '?debug' if req.debug else ''
return werkzeug.utils.redirect('/web{0}#sa={1}'.format(debug, sakey))
-
+
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
return this.do_action(action_client, options);
} else if (_.isNumber(action) || _.isString(action)) {
var self = this;
- return self.rpc("/web/action/load", { action_id: action }).then(function(result) {
+ var additional_context = {
+ active_id : options.additional_context.active_id,
+ active_ids : options.additional_context.active_ids,
+ active_model : options.additional_context.active_model
+ };
+ return self.rpc("/web/action/load", { action_id: action, additional_context : additional_context }).then(function(result) {
return self.do_action(result, options);
});
}
action_views_ids : views_ids
}, self.flags, self.flags[view.view_type] || {}, view.options || {})
});
-
+
views_ids[view.view_type] = view.view_id;
});
if (this.flags.views_switcher === false) {
}
// If no default view defined, switch to the first one in sequence
var default_view = this.flags.default_view || this.views_src[0].view_type;
-
+
return this.switch_mode(default_view, null, this.flags[default_view] && this.flags[default_view].options);
-
-
+
+
},
switch_mode: function(view_type, no_store, view_options) {
var self = this;
}
controller.on('switch_mode', self, this.switch_mode);
controller.on('previous_view', self, this.prev_view);
-
+
var container = this.$el.find("> div > div > .oe_view_manager_body > .oe_view_manager_view_" + view_type);
var view_promise = controller.appendTo(container);
this.views[view_type].controller = controller;
return self.switch_mode(state.view_type, true);
})
);
- }
+ }
$.when(this.views[this.active_view] ? this.views[this.active_view].deferred : $.when(), defs).done(function() {
self.views[self.active_view].controller.do_load_state(state, warm);
/**
* Switches to a specific view type
*/
- do_switch_view: function() {
+ do_switch_view: function() {
this.trigger.apply(this, ['switch_mode'].concat(_.toArray(arguments)));
},
/**