odoo.define('web.KanbanColumn', function (require) { "use strict"; var config = require('web.config'); var core = require('web.core'); var session = require('web.session'); var Dialog = require('web.Dialog'); var KanbanRecord = require('web.KanbanRecord'); var RecordQuickCreate = require('web.kanban_record_quick_create'); var view_dialogs = require('web.view_dialogs'); var viewUtils = require('web.viewUtils'); var Widget = require('web.Widget'); var KanbanColumnProgressBar = require('web.KanbanColumnProgressBar'); var _t = core._t; var QWeb = core.qweb; var KanbanColumn = Widget.extend({ template: 'KanbanView.Group', custom_events: { cancel_quick_create: '_onCancelQuickCreate', quick_create_add_record: '_onQuickCreateAddRecord', tweak_column: '_onTweakColumn', tweak_column_records: '_onTweakColumnRecords', }, events: { 'click .o_column_edit': '_onEditColumn', 'click .o_column_delete': '_onDeleteColumn', 'click .o_kanban_quick_add': '_onAddQuickCreate', 'click .o_kanban_load_more': '_onLoadMore', 'click .o_kanban_toggle_fold': '_onToggleFold', 'click .o_column_archive_records': '_onArchiveRecords', 'click .o_column_unarchive_records': '_onUnarchiveRecords', 'click .o_kanban_config .dropdown-menu': '_onConfigDropdownClicked', }, /** * @override */ init: function (parent, data, options, recordOptions) { this._super(parent); this.db_id = data.id; this.data_records = data.data; this.data = data; var value = data.value; this.id = data.res_id; this.folded = !data.isOpen; this.has_active_field = 'active' in data.fields; this.fields = data.fields; this.records = []; this.modelName = data.model; this.quick_create = options.quick_create; this.quickCreateView = options.quickCreateView; this.groupedBy = options.groupedBy; 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; 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; this.canBeFolded = this.folded; if (options.hasProgressBar) { this.barOptions = { columnID: this.db_id, progressBarStates: options.progressBarStates, }; } this.record_options = _.clone(recordOptions); if (options.grouped_by_m2o || options.grouped_by_date ) { // For many2one and datetime, a false value means that the field is not set. this.title = value ? value : _t('Undefined'); } else { // False and 0 might be valid values for these fields. this.title = value === undefined ? _t('Undefined') : value; } if (options.group_by_tooltip) { this.tooltipInfo = _.compact(_.map(options.group_by_tooltip, function (help, field) { help = help ? help + "
" : ''; return (data.tooltipData && data.tooltipData[field] && "
" + help + data.tooltipData[field] + "
") || ''; })); this.tooltipInfo = this.tooltipInfo.join("