Skip to content
Snippets Groups Projects
Commit d57e5000 authored by Mathieu Duckerts-Antoine's avatar Mathieu Duckerts-Antoine
Browse files

[FIX] web: keep server group order in pivot

In the pivot view, groups comming from many read_group are assemble
to create the header hierarchies and the table.

Groups returned by the read_group may be already sorted by the server
using the order set on the model for instance and that order should
be reflected in the header hierarchies (and in the table).
It is important to keep that order since it might not be possible
to recreate it in the interface. Even if possible it might not be a
good idea for performance reasons.

Before this commit:
The groups are added in a JS object, whose keys are the group ids
(when grouping on a many2one at least). Then, to generate the table,
we iterate over the keys of that object, but those keys are sorted
according to the numerical order (not the insertion order),
because keys are kind of numeric.
See https://stackoverflow.com/questions/5525795/does-javascript-guarantee-object-property-order

.

After this commit:
Instead of a JS object, we use a Map for which the insertion order
is used (official spec).

Task ID: 2243416

closes odoo/odoo#50551

X-original-commit: 1a9a85c8b8d0f47c3c6f3878cd6d9401ddc3ad75
Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
parent 3b80166e
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment