-
Notifications
You must be signed in to change notification settings - Fork 23.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] web: handle field sorting should include id #162933
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kebeclibre
robodoo r+
Since commit 7d2baaa ("Unity read"), we are able to pass a full specification to subfields in a view and retrive records directly according to that specification. This could include "order". In the case of a list view that has a `widget="handle"`, this order is automatically set to "[handle_field] ASC". Before the unity read feature, it did not cause problems for one2manys because the ids of records were retrieved in python using the "natural order" of the model (the `model._order` slot), which usually had the right parameters. (see `sale.order.line` for example). When fetching the ids of the one2many, those were already sorted in natural order. In unity read, the natural order is overriden by the specification and became only "[handle_field] ASC". This was insufficient as more often than not, sequences on model are set up with a default. So eventually, all records couls have the same sequence. The sorting in SQL becomes undeterminate. After this commit, we had the sorting key "id ASC" to avoid any unwanted results. opw-3790378 see discord https://discord.com/channels/678381219515465750/687338039717920792/1231977078564585555 for a detailed discussion.
3a3ec94
to
ecc0a38
Compare
robodoo r+ |
@kebeclibre this pull request has forward-port PRs awaiting action (not merged or closed): |
2 similar comments
@kebeclibre this pull request has forward-port PRs awaiting action (not merged or closed): |
@kebeclibre this pull request has forward-port PRs awaiting action (not merged or closed): |
Since commit 7d2baaa ("Unity read"), we are able to pass a full specification to subfields in a view and retrive records directly according to that specification. This could include "order". In the case of a list view that has a `widget="handle"`, this order is automatically set to "[handle_field] ASC". Before the unity read feature, it did not cause problems for one2manys because the ids of records were retrieved in python using the "natural order" of the model (the `model._order` slot), which usually had the right parameters. (see `sale.order.line` for example). When fetching the ids of the one2many, those were already sorted in natural order. In unity read, the natural order is overriden by the specification and became only "[handle_field] ASC". This was insufficient as more often than not, sequences on model are set up with a default. So eventually, all records couls have the same sequence. The sorting in SQL becomes undeterminate. After this commit, we had the sorting key "id ASC" to avoid any unwanted results. opw-3790378 see discord https://discord.com/channels/678381219515465750/687338039717920792/1231977078564585555 for a detailed discussion. closes odoo#162933 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Since commit 7d2baaa ("Unity read"), we are able to pass a full specification to subfields in a view and retrive records directly according to that specification. This could include "order".
In the case of a list view that has a
widget="handle"
, this order is automatically set to "[handle_field] ASC".Before the unity read feature, it did not cause problems for one2manys because the ids of records were retrieved in python using the "natural order" of the model (the
model._order
slot), which usually had the right parameters. (seesale.order.line
for example). When fetching the ids of the one2many, those were already sorted in natural order.In unity read, the natural order is overriden by the specification and became only "[handle_field] ASC". This was insufficient as more often than not, sequences on model are set up with a default. So eventually, all records couls have the same sequence. The sorting in SQL becomes undeterminate.
After this commit, we had the sorting key "id ASC" to avoid any unwanted results.
opw-3790378
see discord https://discord.com/channels/678381219515465750/687338039717920792/1231977078564585555 for a detailed discussion.
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr