[FIX] kanban view: when creating a view with option create=false, button create was still visible

This commit is contained in:
Cedric Snauwaert
2015-04-29 09:19:10 +02:00
parent a80219e292
commit 2d334b932f
2 changed files with 8 additions and 2 deletions
@@ -97,7 +97,13 @@ var KanbanView = View.extend({
* or into a div of its template
*/
render_buttons: function($node) {
this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this}));
var display = false;
if (this.options.action_buttons !== false) {
display = this.is_action_enabled('create');
} else if (!this.view_id && !this.options.read_only_mode) {
display = this.is_action_enabled('write') || this.is_action_enabled('create');
}
this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this, display: display}));
this.$buttons
.on('click', 'button.oe_kanban_button_new', this.do_add_record)
.on('click', '.oe_kanban_add_column', this.do_add_group);
@@ -13,7 +13,7 @@
</div>
</t>
<t t-name="KanbanView.buttons">
<t t-if="(widget.options.action_buttons !== false and widget.is_action_enabled('create')) or (!widget.view_id and !widget.options.read_only_mode and (widget.is_action_enabled('write') || widget.is_action_enabled('create')))">
<t t-if="display">
<div class="oe_kanban_buttons">
<button type="button" class="oe_kanban_button_new btn btn-primary btn-sm">
<t t-esc="widget.options.create_text || _t('Create')"/>