OdooWiki OCA HUB

Server Actions - Mass Sort Lines

server_action_sort folder_open OCA/server-backend open_in_new
Tools License: AGPL-3

This module provides a generic tools to have the possibility to sort the lines of a list of items.

For exemple, if you use the sale module, you can want to reorder the sale order lines, by any criterias.

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Adds a new 'Sort' option to Server Actions so you can automatically renumber the lines of any one-to-many list (for example sale order lines) according to criteria you choose.

This module extends the standard Server Actions screen (Settings > Technical > Actions > Server Actions) with a new action type called 'Sort'.

When you create or edit a server action and pick 'Sort' as its type, two extra fields appear: 'Field to Sort', where you choose the one-to-many field whose lines should be reordered (for example the order lines of a sale order), and a 'Sorting Criterias' list. In that list you add one or more lines, each selecting a field of the related model and optionally ticking 'Inverse Order' for descending sorting; you can drag the lines to set the priority of the criteria.

When the action runs on a set of records, it searches all the related lines of each record, orders them using your criteria, and rewrites their sequence numbers starting from 1. This means the lines are physically renumbered in the order you defined.

Business rules and safeguards: the action refuses to run if no sorting criteria are defined, and it also refuses to run outside the contextual 'Action' menu. Only users in the Settings group can create, edit or delete sorting criteria; other users can only read them.

It works on any model that has a one-to-many field with a sequence, so it is not limited to sales: purchase orders, invoices, manufacturing orders and similar documents can be sorted the same way.

Depends on

base
Models and fields (2)
  • ir.actions.server · extends an existing modelstate, sort_field_id (Field to Sort), sort_line_ids (Sorting Criterias), sort_field_id_model (Model of the Field to Sort)
  • ir.actions.server.sort.line · new modeldesc (Inverse Order), field_id, sequence, action_id (Action), field_name (Field Name)

Text generated by AI (DeepSeek) from reading the Odoo 18.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: 2 confirmed, 7 with no information of 9 versions.

Sources · Odoo 18.0

Confirmed on 2026-11-03 in branch 18.0 of OCA/server-backend.

terminal Installation and usage

OCA documentation · Odoo 18.0
  • Go to 'Setting / Technical / Actions / Server Actions'
  • Create a new item
  • Set a name that will be used for the Contextual Action
  • choose a model
  • Select 'Sort' option in the field 'Action To Do'
  • Then, select a field to sort of this model. It should be a one2many field.
  • Select then the criterias used to sort the selected field.

Extra options

  • you can define groups whose members will have access to that option.
  • Go to a tree view, for a model for which you have defined a 'Sort' action.
  • Select some items you want to reorder.
  • click on 'Action' Button
  • then click on the name of the configured Action and see the results

Before

After

No verified information in OCA: Installation.

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.