Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Unable to use 'len()' in order of search function

Jaysinh Shukla
on 3/11/14, 9:19 AM 507 views

I want to apply the len(one2many_field) in Search method of ORM. Like this search(..,order = "len(one2many_field)",..) .I want to order the result by finding total number of their children. The one2many field is in the relation to the same table. Presently I am not able to use len() in order.

Example :

 id    name    parent_id
  1     A       - 
  2     B       1 
  3     C       1 
  4     D       - 
  5     E       4

Result :


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 3/11/14, 9:19 AM
Seen: 507 times
Last updated: 3/16/15, 8:10 AM