Variant of field type one2many and many2many for sorted associations

v 6.1 v 7.0 v 8.0 Third Party 3374
Download for 8.0 series
You bought this module and need support ? Click here !
Technical name one2many_sorted
Read description for v 7.0 v 6.1

Variant of field type one2many for sorted associations


import one2many_sorted
_columns = | { 'partner_ids' : one2many_sorted.one2many_sorted
( 'res.partner'
, 'parent_id'
, 'Sorted Partner List'
, order='name.upper(), title'
, search=[('is_company', '=', 'False')]
, set={'is_company' : False}

In the example above, the primary sort criteria is "name" (not case-sensitive), the secondary is "title". Only partners that are physical persons (not is_company) are selected - and only those can be added.

Another possibility is to define a text-property with naming convention "<obj>.<field>.order" (in the example above this would be "res.partner.parent_id.order"). The value of this property is the sort criteria.

The advantage of properties is, that they can by company-individual.

A third possibility is to hand over a "context" key named "one2many_sorted_order" that contains the name of a property.

If no "context" key is found, then the property with the naming convention is taken. If no property is defined, the programmed sort order is taken. Otherwise no sorting takes place.

many2many_sorted has a similar syntax but without search feature.

Note that it works on translated term, not only the text stored in the DB !

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.