reporting-engine icon indicating copy to clipboard operation
reporting-engine copied to clipboard

bi_view_editor: wrong generation of ID column

Open gurneyalex opened this issue 1 year ago • 3 comments

BI View Editor

The id column generated by BI View Editor using CAST(row_number() OVER () as integer) AS id is broken and should be replaced. It generates non stable IDs so when you group or filter records, Odoo will display results not matching the filter or the group in its results.

This issue existed on bi_sql_editor and was fixed by using a subselect to get the rows and then inject the ids.

See method _prepare_request_for_execution on model bi.sql.view for a correct implementation https://github.com/OCA/reporting-engine/blob/e8df660d9b1a0b018fbd504f0a45bc59fe516c98/bi_sql_editor/models/bi_sql_view.py#L618-L638

Affected versions: all versions

gurneyalex avatar May 21 '24 16:05 gurneyalex

for your information @astirpe

gurneyalex avatar May 21 '24 16:05 gurneyalex

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Nov 24 '24 12:11 github-actions[bot]

@gurneyalex @astirpe our workaround here is to sort the query by an id field to make the order deterministic - that leads to consistent results for our use case but might not be possible in every scenario.

dhx avatar Dec 10 '24 15:12 dhx

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Jun 15 '25 12:06 github-actions[bot]