* @param dataset
* @param view_id
* @param defaults
- * @param hidden
+ * @param {Object} [options]
+ * @param {Boolean} [options.hidden=false] hide the search view
+ * @param {Boolean} [options.disable_custom_filters=false] do not load custom filters from ir.filters
*/
- init: function(parent, dataset, view_id, defaults, hidden) {
+ init: function(parent, dataset, view_id, defaults, options) {
+ this.options = _.defaults(options || {}, {
+ hidden: false,
+ disable_custom_filters: false,
+ });
this._super(parent);
this.dataset = dataset;
this.model = dataset.model;
this.inputs = [];
this.controls = {};
- this.hidden = !!hidden;
- this.headless = this.hidden && !this.has_defaults;
+ this.headless = this.options.hidden && !this.has_defaults;
this.input_subviews = [];
.on('add change reset remove', this.proxy('do_search'))
.on('add change reset remove', this.proxy('renderFacets'));
- if (this.hidden) {
+ if (this.options.hidden) {
this.$el.hide();
}
if (this.headless) {
// CustomFilters will be ready (and CustomFilters#filters will be
// correctly filled) by the time this method executes.
var custom_filters = this.custom_filters.filters;
- if (!_(custom_filters).isEmpty()) {
+ if (!this.options.disable_custom_filters && !_(custom_filters).isEmpty()) {
// Check for any is_default custom filter
var personal_filter = _(custom_filters).find(function (filter) {
return filter.user_id && filter.is_default;
var type = action.type.replace(/\./g,'_');
var popup = action.target === 'new';
var inline = action.target === 'inline' || action.target === 'inlineview';
- action.flags = _.extend({
+ action.flags = _.defaults(action.flags || {}, {
views_switcher : !popup && !inline,
search_view : !popup && !inline,
action_buttons : !popup && !inline,
sidebar : !popup && !inline,
pager : !popup && !inline,
- display_title : !popup
- }, action.flags || {});
+ display_title : !popup,
+ search_disable_custom_filters: action.context && action.context.search_disable_custom_filters
+ });
action.menu_id = options.action_menu_id;
if (!(type in this)) {
console.error("Action manager can't handle action of type " + action.type, action);
}
if (this.searchview) {
- this.searchview[(view.controller.searchable === false || this.searchview.hidden) ? 'hide' : 'show']();
+ this.searchview[(view.controller.searchable === false || this.searchview.options.hidden) ? 'hide' : 'show']();
}
this.$el.find('.oe_view_manager_switch a').parent().removeClass('active');
if (this.searchview) {
this.searchview.destroy();
}
- this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, this.flags.search_view === false);
+ var options = {
+ hidden: this.flags.search_view === false,
+ disable_custom_filters: this.flags.search_disable_custom_filters,
+ };
+ this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, options);
this.searchview.on('search_data', self, this.do_searchview_search);
return this.searchview.appendTo(this.$el.find(".oe_view_manager_view_search"));
active_ids: [record_id],
active_model: dataset.model
});
+ if (("" + action.context).match(/\bactive_id\b/)) {
+ // Special case: when the context is evaluted using
+ // the active_id, we want to disable the custom filters.
+ ncontext.add({ search_disable_custom_filters: true });
+ }
}
ncontext.add(action.context || {});
action.context = ncontext;