Variant of field type one2many and many2many for sorted associations

by
Odoo          
v 6.1 Third Party 3358
Download for 6.1 series
You bought this module and need support ? Click here !
Technical name one2many_sorted
LicenseAGPL-3
Websitehttp://www.swing-system.com
Repositorylp:~camptocamp/c2c-rd-addons/6.1
Read description for v 8.0 v 7.0

Variant of field type one2many for sorted associations

Usage:

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

  • This section is meant to ask simple questions or leave a rating.
  • This author can leave a single reply to each comment.
  • 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.