Reputation: 2114
I'm making a kanban view in Odoo 9 to display my model in columns based in a Many2one field.
I've created my kanban view like this:
<kanban create="false" edit="false" delete="false" quick_create="false" default_group_by="resource_id">
I only want this view for read only, I don't want to edit or create because I have another view to do it. It's like a dashboard.
The problem is that I want to disable the drag and drop and sortable feature for the columns. I see that the kanban_view.js
file set the sortable and draggable options by default in the render_grouped
function.
Does anyone know how to disable those features for columns? Or, is there any other way to display my records by columns in a kanban view?
Upvotes: 3
Views: 4681
Reputation: 125
In odoo 13 you can add the records_draggable
attribute to your <kanban>
tag:
<kanban records_draggable="false"></kanban>
For more check the kanban view section in the documentation
Upvotes: 0
Reputation: 5986
To this day, there is no parameter to do this. So in your new module, create a JS extension on KanbanView, override render() and disable the sortable there. Here is the complete .js code for Odoo 10 which should be similar for v9:
odoo.define('my_module.board', function(require) {
"use strict";
var core = require('web.core');
var KanbanView = require('web_kanban.KanbanView');
var MyBoard = KanbanView.extend({
render: function() {
this._super.apply(this, arguments);
this.$el.sortable('option', 'disabled', true);
this.$('.o_kanban_header').css('cursor', 'auto');
}
});
return MyBoard;
});
P.S.: I strongly advise against modifying Odoo base code unless you don't plan on updating.
Upvotes: 0
Reputation: 31
To Disable Drag and Drop of Kanban View records we need to modify at web_kanban module.
Path : web_kanban/static/src/js File : kanban_view.js Modification : Search for the below code
var record_options = _.extend(this.record_options, {
draggable: draggable,
});
Then add
draggable = false
just above given block of code like,
draggable = false [Note : This is the newly added line]
var record_options = _.extend(this.record_options,
{
draggable: draggable,
});
Upvotes: 2