|
@ -67,7 +67,12 @@ odoo.define('web_timeline.TimelineView', function (require) { |
|
|
this.colors = _(this.fields_view.arch.attrs.colors.split(';')).chain().compact().map(function (color_pair) { |
|
|
this.colors = _(this.fields_view.arch.attrs.colors.split(';')).chain().compact().map(function (color_pair) { |
|
|
var pair = color_pair.split(':'), color = pair[0], expr = pair[1]; |
|
|
var pair = color_pair.split(':'), color = pair[0], expr = pair[1]; |
|
|
var temp = py.parse(py.tokenize(expr)); |
|
|
var temp = py.parse(py.tokenize(expr)); |
|
|
return {'color': color, 'field': temp.expressions[0].value, 'opt': temp.operators[0], 'value': temp.expressions[1].value}; |
|
|
|
|
|
|
|
|
return { |
|
|
|
|
|
'color': color, |
|
|
|
|
|
'field': temp.expressions[0].value, |
|
|
|
|
|
'opt': temp.operators[0], |
|
|
|
|
|
'value': temp.expressions[1].value |
|
|
|
|
|
}; |
|
|
}).value(); |
|
|
}).value(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
@ -280,7 +285,11 @@ odoo.define('web_timeline.TimelineView', function (require) { |
|
|
var ids = _.pluck(events, "id"); |
|
|
var ids = _.pluck(events, "id"); |
|
|
return this.dataset.name_get(ids).then(function (names) { |
|
|
return this.dataset.name_get(ids).then(function (names) { |
|
|
var nevents = _.map(events, function (event) { |
|
|
var nevents = _.map(events, function (event) { |
|
|
return _.extend({__name: _.detect(names, function(name) { return name[0] == event.id; })[1]}, event); |
|
|
|
|
|
|
|
|
return _.extend({ |
|
|
|
|
|
__name: _.detect(names, function (name) { |
|
|
|
|
|
return name[0] == event.id; |
|
|
|
|
|
})[1] |
|
|
|
|
|
}, event); |
|
|
}); |
|
|
}); |
|
|
return self.on_data_loaded_2(nevents, group_bys); |
|
|
return self.on_data_loaded_2(nevents, group_bys); |
|
|
}); |
|
|
}); |
|
@ -305,7 +314,9 @@ odoo.define('web_timeline.TimelineView', function (require) { |
|
|
_.each(events, function (event) { |
|
|
_.each(events, function (event) { |
|
|
var group_name = event[_.first(group_bys)]; |
|
|
var group_name = event[_.first(group_bys)]; |
|
|
if (group_name) { |
|
|
if (group_name) { |
|
|
var group = _.find(groups, function(group) { return _.isEqual(group.id, group_name[0]); }); |
|
|
|
|
|
|
|
|
var group = _.find(groups, function (group) { |
|
|
|
|
|
return _.isEqual(group.id, group_name[0]); |
|
|
|
|
|
}); |
|
|
if (group === undefined) { |
|
|
if (group === undefined) { |
|
|
group = {id: group_name[0], content: group_name[1]}; |
|
|
group = {id: group_name[0], content: group_name[1]}; |
|
|
groups.push(group); |
|
|
groups.push(group); |
|
@ -421,11 +432,13 @@ odoo.define('web_timeline.TimelineView', function (require) { |
|
|
|
|
|
|
|
|
on_remove: function (item, callback) { |
|
|
on_remove: function (item, callback) { |
|
|
var self = this; |
|
|
var self = this; |
|
|
|
|
|
|
|
|
function do_it() { |
|
|
function do_it() { |
|
|
return $.when(self.dataset.unlink([item.evt.id])).then(function () { |
|
|
return $.when(self.dataset.unlink([item.evt.id])).then(function () { |
|
|
callback(item); |
|
|
callback(item); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.options.confirm_on_delete) { |
|
|
if (this.options.confirm_on_delete) { |
|
|
if (confirm(_t("Are you sure you want to delete this record ?"))) { |
|
|
if (confirm(_t("Are you sure you want to delete this record ?"))) { |
|
|
return do_it(); |
|
|
return do_it(); |
|
|