[IMP] add default order to kanban views

Now, the kanban view can be sorted by any field by default.  It just
needs to be given in the xml descriptor.  For ex,

<field name="arch" type="xml">
    <kanban order="country_id">
This commit is contained in:
Géry Debongnie 2014-06-13 12:08:36 +02:00
parent 4c0222355d
commit 44db8772ec
1 changed files with 8 additions and 0 deletions

View File

@ -62,6 +62,14 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
},
load_kanban: function(data) {
this.fields_view = data;
// use default order if defined in xml description
var default_order = this.fields_view.arch.attrs.order,
unsorted = !this.dataset._sort.length;
if (unsorted && default_order) {
this.dataset.sort(default_order);
}
this.$el.addClass(this.fields_view.arch.attrs['class']);
this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this}));
if (this.options.$buttons) {