Jam.py documentation

set_order_by

set_order_by(self, lst=None, *fields)

domain: server

language: python

class Item class

Description

Use the set_order_by method to define and store internally the order_by parameter that will be used by the open method, when its own order_by parameter is not specified. The open method clears internally stored parameter value.

Parameters

You can specify the fields as a list, the way the set_order_by method on the client does or as non-keyworded arguments.

If there is a sign ‘-‘ before a field name, then on this field records will be sorted in decreasing order.

Example

The result of the execution of following code snippets will be the same:

item.open(order_by=['customer', '-invoicedate'])
item.set_order_by('customer', '-invoicedate')
item.open();
item.set_order_by(['customer', '-invoicedate'])
item.open();

See also

Dataset

open