[FIX] OPW 598942 : orm read_group doesn't take referenced fields or aggregated fields in account when sorting
Sorting was done using a search on ids that where found in a custom SQL field,
only 1 record among aggregated records with same groupby value was used
when using search for ordering, resulting data ordered on
max(aggregated_data).field_value instead of sum(aggregated_data.field_value).
[FIX] typo, wrong ordering of lines
[IMP] Speed and quality improvement
  - removing the need of the use of search when groupby is set on a relation
    field.
  - creation and use of dedicated helper method to compute the orderby clause
    for easier reading
[REF] removing debug code
[FIX] OPW 598942 : orm read_group doesn't take referenced fields or aggregated fields in account when sorting
Sorting was done using a search on ids that where found in a custom SQL field,
only 1 record among aggregated records with same groupby value was used
when using search for ordering, resulting data ordered on
max(aggregated_data).field_value instead of sum(aggregated_data.field_value).
[REF] removing useless comment
[MERGE] [FIX] orm: read_group doesn't take referenced fields or aggregated fields in account when sorting (opw 598942)

Sorting was done using a search on ids that where found in a custom SQL field,
only 1 record among aggregated records with same groupby value was used
when using search for ordering, resulting data ordered on
max(aggregated_data).field_value instead of sum(aggregated_data.field_value).