summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/view_list.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-10-23 10:53:29 +0200
committerXavier Morel <xmo@openerp.com>2012-10-23 10:53:29 +0200
commit9bf9ca7a67a16b83cfa371c1377865e168d6c7dc (patch)
treeda9ad155dae5b37c0a56111c11730acad2e3444b /addons/web/static/src/js/view_list.js
parent41fba390b243844828cb3f2d7c83dc00b4545f50 (diff)
[FIX] list view to use View#load_view rather than its own implementation thereof
bzr revid: xmo@openerp.com-20121023085329-y01e1u77vfz2n7a9
Diffstat (limited to 'addons/web/static/src/js/view_list.js')
-rw-r--r--addons/web/static/src/js/view_list.js34
1 files changed, 12 insertions, 22 deletions
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index 29bc81ea9ec..4da6136d3cc 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -22,6 +22,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
'reorderable': true,
'action_buttons': true,
},
+ view_type: 'tree',
/**
* Core class for list-type displays.
*
@@ -83,7 +84,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
});
this.no_leaf = false;
- this.on('view_load', self, self.load_list);
+ this.grouped = false;
+ this.on('view_loaded', self, self.load_list);
},
set_default_options: function (options) {
this._super(options);
@@ -145,7 +147,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
*/
start: function() {
this.$el.addClass('oe_list');
- return this.reload_view(null, null, true);
+ return this._super();
},
/**
* Returns the style for the provided record in the current view (from the
@@ -219,7 +221,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
* @param {Object} data.fields_view.arch current list view descriptor
* @param {Boolean} grouped Is the list view grouped
*/
- load_list: function(data, grouped) {
+ load_list: function(data) {
var self = this;
this.fields_view = data;
this.name = "" + this.fields_view.arch.attrs.string;
@@ -245,7 +247,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
}).value();
}
- this.setup_columns(this.fields_view.fields, grouped);
+ this.setup_columns(this.fields_view.fields, this.grouped);
this.$el.html(QWeb.render(this._template, this));
this.$el.addClass(this.fields_view.arch.attrs['class']);
@@ -290,7 +292,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
}
this.$buttons.find('.oe_list_add')
.click(this.proxy('do_add_record'))
- .prop('disabled', grouped);
+ .prop('disabled', this.grouped);
}
// Pager
@@ -359,7 +361,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
this.sidebar.add_toolbar(this.fields_view.toolbar);
this.sidebar.$el.hide();
}
- this.trigger('list_view_loaded', data, grouped);
+ this.trigger('list_view_loaded', data, this.grouped);
},
/**
* Configures the ListView pager based on the provided dataset's information
@@ -464,25 +466,12 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
/**
* Reloads the list view based on the current settings (dataset & al)
*
+ * @deprecated
* @param {Boolean} [grouped] Should the list be displayed grouped
* @param {Object} [context] context to send the server while loading the view
*/
reload_view: function (grouped, context, initial) {
- var self = this;
- var callback = function (field_view_get) {
- self.load_list(field_view_get, grouped);
- };
- if (this.embedded_view) {
- return $.Deferred().then(callback).resolve(this.embedded_view);
- } else {
- return this.rpc('/web/view/load', {
- model: this.model,
- view_id: this.view_id,
- view_type: "tree",
- context: this.dataset.get_context(context),
- toolbar: !!this.options.$sidebar
- }).then(callback);
- }
+ return this.load_view(context);
},
/**
* re-renders the content of the list view
@@ -564,8 +553,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
group_by = null;
}
this.no_leaf = !!context['group_by_no_leaf'];
+ this.grouped = !!group_by;
- this.reload_view(!!group_by, context).then(
+ return this.load_view(context).pipe(
this.proxy('reload_content'));
},
/**