mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[CHG] Avoid to display all items of group_by model
This commit is contained in:
committed by
Tom Blauwendraat
parent
8a11d2ef73
commit
233f3c1cce
@@ -306,11 +306,26 @@ openerp.web_timeline = function(instance) {
|
||||
var groups = [];
|
||||
groups.push({id:-1, content: _t('Undefined')})
|
||||
_.each(tasks, function(event) {
|
||||
data.push(self.event_data_transform(event));
|
||||
});
|
||||
_.each(self.groups, function(group){
|
||||
groups.push({id: group[0], content: group[1]});
|
||||
if (event[self.date_start]){
|
||||
data.push(self.event_data_transform(event));
|
||||
}
|
||||
});
|
||||
// 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);
|
||||
|
||||
Reference in New Issue
Block a user