OdooWiki OCA HUB

Base order by related

base_order_by_related folder_open OCA/server-tools open_in_new
Tools License: AGPL-3

This module allows a search to order by a non-stored related field.

auto_awesome What this module does

AI-generated from the code · Odoo 14.0

Allows list views to be sorted by related fields that are not stored in the database, such as a customer's country shown on a sales order.

This is a technical tool that changes how Odoo sorts records in list views. Normally, Odoo can only sort by fields that are physically stored in the database. This module lets developers mark certain related fields as sortable, so users can click the column header and sort by them.

  • It extends the base model, so the behaviour is available everywhere in Odoo.
  • A developer adds field names to a special list on a model; those fields then become sortable in list views.
  • When a user sorts by one of these fields, Odoo automatically builds the necessary database joins to reach the related record and order by its value.
  • The module also marks those fields as sortable in the field definitions, so the sorting option appears in the user interface.
  • It supports translated fields and handles ascending and descending order.

No new menus, screens, or buttons are added. The change is invisible until a developer configures a model to use it. It touches the base model and the way list views generate their sorting instructions.

Depends on

base
Models and fields (1)
  • base · extends an existing model

Text generated by AI (DeepSeek) from reading the Odoo 14.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 1 confirmed, 8 with no information of 9 versions.

Sources · Odoo 14.0

Confirmed on 2026-11-03 in branch 14.0 of OCA/server-tools.

terminal Installation and usage

OCA documentation · Odoo 14.0

In any model where you have a non-stored related field, you can make it sortable:

class ResPartner(models.Model):
    _inherit = "res.partner"

    country_name = fields.Char(related="country_id.name")

    # make some non-stored related fields sortable
    _order_by_related = ["country_name"]

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.