1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
odoo.define('project.project_kanban', function (require) {
'use strict';
var KanbanController = require('web.KanbanController');
var KanbanView = require('web.KanbanView');
var KanbanColumn = require('web.KanbanColumn');
var view_registry = require('web.view_registry');
var KanbanRecord = require('web.KanbanRecord');
KanbanRecord.include({
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
* @override
* @private
*/
// YTI TODO: Should be transformed into a extend and specific to project
_openRecord: function () {
if (this.selectionMode !== true && this.modelName === 'project.project' &&
this.$(".o_project_kanban_boxes a").length) {
this.$('.o_project_kanban_boxes a').first().click();
} else {
this._super.apply(this, arguments);
}
},
});
var ProjectKanbanController = KanbanController.extend({
custom_events: _.extend({}, KanbanController.prototype.custom_events, {
'kanban_column_delete_wizard': '_onDeleteColumnWizard',
}),
_onDeleteColumnWizard: function (ev) {
ev.stopPropagation();
const self = this;
const column_id = ev.target.id;
var state = this.model.get(this.handle, {raw: true});
this._rpc({
model: 'project.task.type',
method: 'unlink_wizard',
args: [column_id],
context: state.getContext(),
}).then(function (res) {
self.do_action(res);
});
}
});
var ProjectKanbanView = KanbanView.extend({
config: _.extend({}, KanbanView.prototype.config, {
Controller: ProjectKanbanController
}),
});
KanbanColumn.include({
_onDeleteColumn: function (event) {
event.preventDefault();
if (this.modelName === 'project.task') {
this.trigger_up('kanban_column_delete_wizard');
return;
}
this._super.apply(this, arguments);
}
});
view_registry.add('project_kanban', ProjectKanbanView);
return ProjectKanbanController;
});
|