Closed xmglord closed 7 months ago
@Bruno-Zanotti and @jjscarafia please review.
FYI this is related to #82
CC @desdelinux, @moylop260
After reviewing the main motivation for this change (https://github.com/odoo/odoo/pull/110737), I consider that the replace of read_group
by _read_group
is actually expected in almost most changes. This because read_group
was initially meant to be used by the web client, but we started to use it in backend to group data. Now _read_group
serves that purpose better and on a more-efficient manner.
So @xmglord I think this issue should be closed.
Regards,
Upon reviewing the functionalities of both methods as per the latest Odoo documentation, it appears that this change might not be accurate due to the distinct purposes and functionalities that each method serves.
Model._read_group: This method is primarily designed for getting fields aggregations, specified by aggregates, and grouped by the given groupby fields where records are filtered by the domain. It supports advanced aggregations and is tailored for more complex group-by queries.
Model.read_group: This method focuses on retrieving a list of records in a list view, grouped by specified groupby fields. It is designed to be used for generating grouped views in the UI, supporting a simpler and more direct way of aggregating data for presentation.
Parameters and Return Types: The Model._read_group method allows for a detailed specification of aggregates and having clauses, catering to complex SQL-like aggregations. In contrast, Model.read_group is structured around the list view's needs, providing a simpler interface for aggregating and displaying data.
Use Cases: The usage of _read_group is more aligned with backend data processing and complex data aggregation scenarios. On the other hand, read_group is tailored towards frontend data presentation, particularly in grouping data for display in Odoo's list views.
Given these distinctions, replacing read_group by _read_group can potentially disrupt the intended functionality of modules that rely on these methods for specific purposes. The direct replacement overlooks the nuanced differences in their applications, leading to possible issues in data presentation and aggregation in migrated modules.