[FIX] web_kanban: correctly handle nocontent grouped kanban

The nocontent message was never there when the kanban had no content
in grouped mode and the create button was muted even if no column can
be added. Also it was wrongly displayed in ungrouped mode.
This commit is contained in:
qsm-odoo
2016-09-02 10:57:29 +01:00
parent 2f8d1ec5e8
commit 58153ea0ec
3 changed files with 18 additions and 6 deletions
@@ -49,7 +49,7 @@
table-layout: fixed;
border-spacing: @sale-table-spacing 0px;
border-collapse: separate;
> tbody > tr > td {
vertical-align: middle;
text-align: center;
@@ -104,4 +104,8 @@
}
}
}
&.o_kanban_nocontent .o_sales_dashboard {
margin: 0;
}
}
@@ -344,7 +344,7 @@ var KanbanView = View.extend({
update_buttons: function() {
if (this.$buttons) {
// In grouped mode, set 'Create' button as btn-default if there is no column
var create_muted = !!this.grouped && this.widgets.length === 0;
var create_muted = !!this.grouped && this.widgets.length === 0 && this.is_action_enabled('group_create') && this.grouped_by_m2o;
this.$buttons.find('.o-kanban-button-new')
.toggleClass('btn-primary', !create_muted)
.toggleClass('btn-default', create_muted);
@@ -388,7 +388,7 @@ var KanbanView = View.extend({
// cleanup
this.$el.css({display:'-webkit-flex'});
this.$el.css({display:'flex'});
this.$el.removeClass('o_kanban_ungrouped o_kanban_grouped');
this.$el.removeClass('o_kanban_ungrouped o_kanban_grouped o_kanban_nocontent');
_.invoke(this.widgets, 'destroy');
this.$el.empty();
this.widgets = [];
@@ -411,13 +411,16 @@ var KanbanView = View.extend({
if (this.data.grouped) {
this.$el.addClass('o_kanban_grouped');
this.render_grouped(fragment);
} else if (this.data.is_empty) {
this.$el.addClass('o_kanban_ungrouped');
this.render_no_content(fragment);
} else {
this.$el.addClass('o_kanban_ungrouped');
this.render_ungrouped(fragment);
}
if (this.data.is_empty && this.widgets.length === 0 && (!this.data.grouped || !this.is_action_enabled('group_create') || !this.grouped_by_m2o)) {
this.$el.css("display", "block");
this.$el.addClass("o_kanban_nocontent");
this.render_no_content(fragment);
}
this.$el.append(fragment);
},
@@ -194,6 +194,11 @@
}
}
&.o_kanban_nocontent {
min-height: 0;
padding: 0;
}
&.o_kanban_mobile .o_kanban_record {
span, div.label {
.o_text_overflow;