Browse Source

[CHG] Avoid to display all items of group_by model

pull/908/head
Adrien Peiffer (ACSONE) 9 years ago
committed by Tom Blauwendraat
parent
commit
233f3c1cce
  1. 19
      web_timeline/static/src/js/web_timeline.js

19
web_timeline/static/src/js/web_timeline.js

@ -306,11 +306,26 @@ openerp.web_timeline = function(instance) {
var groups = [];
groups.push({id:-1, content: _t('Undefined')})
_.each(tasks, function(event) {
if (event[self.date_start]){
data.push(self.event_data_transform(event));
}
});
_.each(self.groups, function(group){
groups.push({id: group[0], content: group[1]});
// get the groups
var split_groups = function(tasks, group_bys) {
if (group_bys.length === 0)
return tasks;
var groups = [];
_.each(tasks, function(task) {
var group_name = task[_.first(group_bys)];
var group = _.find(groups, function(group) { return _.isEqual(group.id, group_name[0]); });
if (group === undefined) {
group = {id: group_name[0], content: group_name[1]};
groups.push(group);
}
});
return groups;
}
var groups = split_groups(tasks, group_bys);
this.timeline.setGroups(groups);
this.timeline.setItems(data);
this.timeline.setWindow(this.current_window);

Loading…
Cancel
Save