mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX] web_timeline: order group_by field
Fix bug #2266: before this fix, the lines of the timeline view were always sorted by alphabetical order, ignoring the native order of the model on which the group_by field points to. Fix duplicate entries in the 'fields' argument when the 'colors' parameters uses the same field in multiple conditions.
This commit is contained in:
@@ -35,6 +35,7 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||
this.date_delay = params.date_delay;
|
||||
this.colors = params.colors;
|
||||
this.fieldNames = params.fieldNames;
|
||||
this.default_group_by = params.default_group_by;
|
||||
this.dependency_arrow = params.dependency_arrow;
|
||||
this.modelClass = params.view.model;
|
||||
this.fields = params.fields;
|
||||
@@ -376,7 +377,8 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||
return events;
|
||||
}
|
||||
const groups = [];
|
||||
groups.push({id: -1, content: _t("<b>UNASSIGNED</b>")});
|
||||
groups.push({id: -1, content: _t("<b>UNASSIGNED</b>"), order: -1});
|
||||
var seq = 1;
|
||||
for (const evt of events) {
|
||||
const group_name = evt[_.first(group_bys)];
|
||||
if (group_name) {
|
||||
@@ -389,7 +391,9 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||
groups.push({
|
||||
id: group_name[0],
|
||||
content: group_name[1],
|
||||
order: seq,
|
||||
});
|
||||
seq += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -470,6 +474,7 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||
start: date_start,
|
||||
content: content,
|
||||
id: evt.id,
|
||||
order: evt.order,
|
||||
group: group,
|
||||
evt: evt,
|
||||
style: `background-color: ${this.color};`,
|
||||
|
||||
Reference in New Issue
Block a user