summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurélien Warnon <awa@odoo.com>2019-05-16 14:51:12 +0000
committerAurélien Warnon <awa@odoo.com>2019-09-20 12:12:09 +0000
commit869a5b83a57d8a4132507fe89e2bf59c8f5336db (patch)
treeb52c3485e6d9a1cb59a4ad1ca7ba1b8a62b1de84
parentf783a1cc94c877fc339aa096e427ada9c4d415c4 (diff)
[IMP] web: add capability to disable records drag/drop on kanban views
This commit adds a recordsDraggable option on the kanban view that allows to completly disable the drag and drop feature. This is a preliminary work for the social 'Feeds' kanban where the user should not be able to drag and drop posts.
-rw-r--r--addons/web/static/src/js/views/kanban/kanban_column.js3
-rw-r--r--addons/web/static/src/js/views/kanban/kanban_view.js1
-rw-r--r--doc/reference/views.rst2
3 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/kanban/kanban_column.js b/addons/web/static/src/js/views/kanban/kanban_column.js
index b4aecd7a236..0facd099370 100644
--- a/addons/web/static/src/js/views/kanban/kanban_column.js
+++ b/addons/web/static/src/js/views/kanban/kanban_column.js
@@ -59,6 +59,7 @@ var KanbanColumn = Widget.extend({
this.KanbanRecord = options.KanbanRecord || KanbanRecord; // the KanbanRecord class to use
this.records_editable = options.records_editable;
this.records_deletable = options.records_deletable;
+ this.recordsDraggable = options.recordsDraggable;
this.relation = options.relation;
this.offset = 0;
this.remaining = data.count - this.data_records.length;
@@ -100,7 +101,7 @@ var KanbanColumn = Widget.extend({
defs.push(this._addRecord(this.data_records[i]));
}
- if (!config.device.isMobile) {
+ if (this.recordsDraggable && !config.device.isMobile) {
// deactivate sortable in mobile mode. It does not work anyway,
// and it breaks horizontal scrolling in kanban views. Someday, we
// should find a way to use the touch events to make sortable work.
diff --git a/addons/web/static/src/js/views/kanban/kanban_view.js b/addons/web/static/src/js/views/kanban/kanban_view.js
index 62205a2fc46..d265ca6ae6b 100644
--- a/addons/web/static/src/js/views/kanban/kanban_view.js
+++ b/addons/web/static/src/js/views/kanban/kanban_view.js
@@ -65,6 +65,7 @@ var KanbanView = BasicView.extend({
archivable: archAttrs.archivable ? !!JSON.parse(archAttrs.archivable) : true,
group_creatable: activeActions.group_create && !config.device.isMobile,
quickCreateView: archAttrs.quick_create_view || null,
+ recordsDraggable: archAttrs.records_draggable ? !!JSON.parse(archAttrs.records_draggable) : true,
hasProgressBar: !!progressBar,
};
this.rendererParams.record_options = {
diff --git a/doc/reference/views.rst b/doc/reference/views.rst
index 5e6fa266d93..9ab78b45073 100644
--- a/doc/reference/views.rst
+++ b/doc/reference/views.rst
@@ -1052,6 +1052,8 @@ attributes:
whether it should be possible to create records without switching to the
form view. By default, ``quick_create`` is enabled when the Kanban view is
grouped by many2one, selection, char or boolean fields, and disabled when not.
+``records_draggable``
+ whether it should be possible to drag records when kanban is grouped. Default: true.
Set to ``true`` to always enable it, and to ``false`` to always disable it.