summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2018-09-13 17:53:12 +0200
committerThibault Delavallée <tde@odoo.com>2018-09-21 11:22:01 +0200
commit6663ff97b66fb3169f36bbc44e6bcffa5715c228 (patch)
treebef3b7d25875cb04d212bc0d3e4a51fa7faad240 /addons/web/static/src/js
parentda03aa31386d50e7f8a5853daabf29ce75e7eaf8 (diff)
[IMP] web: add an option to hide archive option in kanban columns
Currently kanban columns propose an Archive / Unarchive option if the records model has an active field. It allows to directly archive or restore all records belonging to that column. It is currently not possible to control whether this option is present or not as it only depends on the active field being defined on the model. In some specific cases we want to be able to hide this option even if the active field exists. For example future commits will hide this option for leads (crm.lead) as business flow goes through marking them as won or lost instead of archiving / restoring them. This commit adds support of a new archivable parameter when defining the kanban view that hides the archive buttons if it is set to False. Default value is true so that current behavior is kept as it is by default. Doc and tests are added. This commit is linked to task ID 1880051 and PR #26977.
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views/kanban/kanban_column.js1
-rw-r--r--addons/web/static/src/js/views/kanban/kanban_view.js1
2 files changed, 2 insertions, 0 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 6fea1c36d32..ef75caca8c0 100644
--- a/addons/web/static/src/js/views/kanban/kanban_column.js
+++ b/addons/web/static/src/js/views/kanban/kanban_column.js
@@ -53,6 +53,7 @@ var KanbanColumn = Widget.extend({
this.grouped_by_m2o = options.grouped_by_m2o;
this.editable = options.editable;
this.deletable = options.deletable;
+ this.archivable = options.archivable;
this.draggable = options.draggable;
this.KanbanRecord = options.KanbanRecord || KanbanRecord; // the KanbanRecord class to use
this.records_editable = options.records_editable;
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 99be6175da3..791e3664668 100644
--- a/addons/web/static/src/js/views/kanban/kanban_view.js
+++ b/addons/web/static/src/js/views/kanban/kanban_view.js
@@ -61,6 +61,7 @@ var KanbanView = BasicView.extend({
this.rendererParams.column_options = {
editable: activeActions.group_edit,
deletable: activeActions.group_delete,
+ archivable: this.arch.attrs.archivable ? JSON.parse(this.arch.attrs.archivable) : true,
group_creatable: activeActions.group_create && !config.device.isMobile,
quick_create: params.isQuickCreateEnabled || this._isQuickCreateEnabled(),
quickCreateView: this.arch.attrs.quick_create_view || null,