-
- Downloads
[FIX] various: enforce consistent listview ordering
During the listview OWL refactoring, it was refactored to have a default orderby of any field with the `handle` in the view (if no others are defined): https://github.com/odoo/odoo/blob/adde4917ccbceb7eb56e8a0326d7aef3ad7e0298/addons/web/static/src/views/list/list_arch_parser.js#L217-L218 Unfortunately this field is often the `sequence` field which is sometimes created without a `default` field value and can therefore sometimes be stored in the database as `NULL`. This made it so listviews that can have `NULL` sequence values will have an inconsistent ordering when the view is opened, even if the sequence appears to be `0` from within Odoo. Reason why this is happening: Previously, since there was no default orderby in the listview, so the `web_search_read` was called without an orderby parameter and would default to the model's `_order` value. Why this is a problem: in some cases this can lead to confusing behavior where the displayed listview order is NOT the order that the records will be read in some flows. E.g. multiple BoMs for the same product with no seq set for any of them. The BoM closest to the beginning of the list (when no ordering set) is the one expected to be selected by default when starting a new MO for that product (and the ordering of the BoM field dropdown list should also match the list ordering), but it may not since the ordering in the BoM list view is not consistent. More serious example is the ordering of BoM operation steps being inconsistently shown since it may not match the step order in the WO. Solution: In master the ORM will be updated so the order will be determinstic in this case. In stable we will manually update the relevant listviews with a `default_order` that follows the pre-OWL `_order` ordering. This applies to listviews for models that: - have a sequence field with NO default value - have a listview for that model that allows for creating records without the sequence being set (i.e. seq is NOT required + is created via a form view that DOES NOT have the field in it. Note that this means many2many/one2many fields within another records are not included since "Add a Line" usually acts like the "create" button within a list view) - previously had a deterministic ordering related to the sequence (e.g. `order = "sequence, id"`, but NOT `order = "sequence"`) Other notes: - For existing dbs, this fix will not be auto-applied and will require a manual update - Some cases may have been missed since it's a manual process to check whether the use cases of applicable models have a view where the ordering is inconsistent (e.g. does "create" open a form or not) closes odoo/odoo#110406 Related: odoo/enterprise#36043 Signed-off-by:Arnold Moyaux (arm) <arm@odoo.com>
Showing
- addons/fleet/views/fleet_vehicle_model_views.xml 1 addition, 1 deletionaddons/fleet/views/fleet_vehicle_model_views.xml
- addons/mrp/views/mrp_bom_views.xml 1 addition, 1 deletionaddons/mrp/views/mrp_bom_views.xml
- addons/product/views/product_attribute_views.xml 1 addition, 1 deletionaddons/product/views/product_attribute_views.xml
- addons/stock/views/stock_picking_type_views.xml 1 addition, 1 deletionaddons/stock/views/stock_picking_type_views.xml
- addons/website_event_exhibitor/views/event_sponsor_views.xml 1 addition, 1 deletionaddons/website_event_exhibitor/views/event_sponsor_views.xml
Please register or sign in to comment