[IMP] search views: more generic name for saved filters
authorOlivier Dony <odo@openerp.com>
Mon, 30 Jun 2014 17:48:11 +0000 (19:48 +0200)
committerOlivier Dony <odo@openerp.com>
Tue, 1 Jul 2014 01:29:04 +0000 (03:29 +0200)
Also rename variables to a more neutral term
that will hopefully remain untouched (custom filters)
regardless of the UI label.

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

index 0ec63b8..3fce58f 100644 (file)
@@ -802,13 +802,13 @@ instance.web.SearchViewDrawer = instance.web.Widget.extend({
         var $first_col = this.$(".col-md-7"),
             $snd_col = this.$(".col-md-5");
 
-        var add_custom_reports = in_drawer[0].appendTo($first_col),
+        var add_custom_filters = in_drawer[0].appendTo($first_col),
             add_filters = in_drawer[1].appendTo($first_col),
             add_rest = $.when.apply(null, _(in_drawer.slice(2)).invoke('appendTo', $snd_col)),
             defaults_fetched = $.when.apply(null, _(this.inputs).invoke(
                 'facet_for_defaults', this.searchview.defaults));
 
-        return $.when(defaults_fetched, add_custom_reports, add_filters, add_rest);
+        return $.when(defaults_fetched, add_custom_filters, add_filters, add_rest);
     },
     /**
      * Sets up thingie where all the mess is put?
@@ -900,7 +900,7 @@ instance.web.SearchViewDrawer = instance.web.Widget.extend({
 
     add_common_inputs: function() {
         // add custom filters to this.inputs
-        this.custom_filters = new instance.web.search.CustomReports(this);
+        this.custom_filters = new instance.web.search.CustomFilters(this);
         // add Filters to this.inputs, need view.controls filled
         (new instance.web.search.Filters(this));
         (new instance.web.search.SaveFilter(this, this.custom_filters));
@@ -1690,8 +1690,8 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
     }
 });
 
-instance.web.search.CustomReports = instance.web.search.Input.extend({
-    template: 'SearchView.CustomReports',
+instance.web.search.CustomFilters = instance.web.search.Input.extend({
+    template: 'SearchView.Custom',
     _in_drawer: true,
     init: function () {
         this.is_ready = $.Deferred();
@@ -1837,9 +1837,9 @@ instance.web.search.CustomReports = instance.web.search.Input.extend({
 instance.web.search.SaveFilter = instance.web.search.Input.extend({
     template: 'SearchView.SaveFilter',
     _in_drawer: true,
-    init: function (parent, custom_reports) {
+    init: function (parent, custom_filters) {
         this._super(parent);
-        this.custom_reports = custom_reports;
+        this.custom_filters = custom_filters;
     },
     start: function () {
         var self = this;
@@ -1883,13 +1883,14 @@ instance.web.search.SaveFilter = instance.web.search.Input.extend({
                 model_id: self.view.model,
                 context: results.context,
                 domain: results.domain,
-                is_default: set_as_default
+                is_default: set_as_default,
+                action_id: self.custom_filters.get_action_id()
             };
             // FIXME: current context?
             return self.model.call('create_or_replace', [filter]).done(function (id) {
                 filter.id = id;
-                if (self.custom_reports) {
-                    self.custom_reports.append_filter(filter);
+                if (self.custom_filters) {
+                    self.custom_filters.append_filter(filter);
                 }
                 self.$el
                     .removeClass('oe_opened')
index adae3be..8c83381 100644 (file)
 </div>
 
 
-<div t-name="SearchView.CustomReports" class="oe_searchview_custom oe_searchview_section">
+<div t-name="SearchView.Custom" class="oe_searchview_custom oe_searchview_section">
     <dl class="dl-horizontal">
-        <dt><span class="oe_i">M</span> Custom Reports</dt>
+        <dt><span class="oe_i">M</span> Favorites</dt>
         <dd><ul class="oe_searchview_custom_list"/></dd>
     </dl>
 </div>