[FIX] add support for default filters in search view

support for default filters was broken in the previous commit,
now it works again.
This commit is contained in:
Géry Debongnie 2014-05-19 15:40:45 +02:00
parent 7e6d223e9e
commit 646de9e5af
4 changed files with 18 additions and 16 deletions

View File

@ -1778,6 +1778,7 @@
}
.openerp .oe_searchview_drawer_container {
border-bottom: 1px solid #afafb6;
overflow: auto;
}
.openerp .oe_view_nocontent {
padding: 15px;

View File

@ -1280,7 +1280,7 @@ $sheet-padding: 16px
&.oe_searchview_open_drawer
.oe_searchview_drawer
display: block
.oe_searchview_drawer
cursor: default
position: absolute
@ -1460,6 +1460,7 @@ $sheet-padding: 16px
.oe_searchview_drawer_container
border-bottom: 1px solid $tag-border
overflow: auto
// }}}
// Views Common {{{

View File

@ -640,8 +640,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
});
},
setup_default_query: function () {
this.ready.resolve();
return;
// Hacky implementation of CustomFilters#facet_for_defaults ensure
// CustomFilters will be ready (and CustomFilters#filters will be
// correctly filled) by the time this method executes.
@ -803,23 +801,25 @@ instance.web.SearchViewDrawer = instance.web.Widget.extend({
this.add_common_inputs();
// build drawer
var drawer_started = $.when.apply(
null, _(this.select_for_drawer()).invoke(
'appendTo', this.$el));
var in_drawer = this.select_for_drawer();
// load defaults
// var defaults_fetched = $.when.apply(null, _(this.inputs).invoke(
// 'facet_for_defaults', this.defaults))
// .then(this.proxy('setup_default_query'));
var self = this;
var second_col = $('<div class="col-md-5">');
var insert_first_col = in_drawer[0].appendTo(this.$el).then(function () {
second_col.appendTo(self.$el);
}).then(function () {
return $.when.apply(null,
_(_.rest(in_drawer)).invoke('appendTo', second_col));
});
return $.when.apply(null, _(this.inputs).invoke(
'facet_for_defaults', this.searchview.defaults));
},
notify_searchview: function () {
this.searchview.drawer_ready.resolve();
// with args...
// this.searchview.drawer_ready.resolve();
var defaults = arguments[1];
this.searchview.drawer_ready.resolve.apply(null, defaults);
},
/**
* Sets up thingie where all the mess is put?

View File

@ -1717,7 +1717,7 @@
</div>
</div>
</t>
<div t-name="SearchView.Filters" class="oe_searchview_filters oe_searchview_section">
<div t-name="SearchView.Filters" class="oe_searchview_filters oe_searchview_section col-md-7">
</div>
<div t-name="SearchView.CustomFilters" class="oe_searchview_custom oe_searchview_section">