[FIX] add support for default filters in search view
authorGéry Debongnie <ged@odoo.com>
Mon, 19 May 2014 13:40:45 +0000 (15:40 +0200)
committerGéry Debongnie <ged@odoo.com>
Mon, 19 May 2014 13:40:45 +0000 (15:40 +0200)
support for default filters was broken in the previous commit,
now it works again.

addons/web/static/src/css/base.css
addons/web/static/src/css/base.sass
addons/web/static/src/js/search.js
addons/web/static/src/xml/base.xml

index 03066c1..ade49c3 100644 (file)
 }
 .openerp .oe_searchview_drawer_container {
   border-bottom: 1px solid #afafb6;
+  overflow: auto;
 }
 .openerp .oe_view_nocontent {
   padding: 15px;
index e129692..d85b55d 100644 (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 {{{
index 88cf753..0bd4c89 100644 (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?
index 22e344f..542a740 100644 (file)
         </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">