i want the user to only view the opportunities by its stages in kanban view and not to change the stages ? And disable sorting columns (stages) All solutions i found for other versions 7 , 10 and 13 not odoo version12
According to kanban view documentation, to disable editing stages you can set group_edit
option to false
on kanban
tag.
<kanban ... group_edit="false">
To disable column sorting I did not find an option, it seems that the renderer (_renderGrouped
) only checks if the stage field is of type many2one
, so I added a new option to enable or disable column sorting.
var KanbanRenderer = require('web.KanbanRenderer');
KanbanRenderer.include({
_setState: function (state) {
var self = this;
this._super(state);
if (this.arch.attrs.sortable) {
this.columnOptions = _.extend(self.columnOptions, {
sortable: this.arch.attrs.sortable === 'true',
});
}
if (this.arch.attrs.disable_drag_drop_record) {
if (this.arch.attrs.disable_drag_drop_record=='true') {
this.columnOptions.draggable = false;
}
}
},
_renderGrouped: function (fragment) {
this._super.apply(this, arguments);
if (this.columnOptions.sortable===false) {
// remove previous sorting
this.$el.sortable('destroy');
}
},
});
Set sortable
attribute to false
in kanban view:
<kanban ... sortable="false" disable_drag_drop_record="true">