1

I have a one2many field which has a column named abc in which i am storing ids. It has sequence as 1, 1.1, 1.2, 1.n. I am trying sort according to the abc column of one2many field but i am facing an issue related to the sorting that is, When the ids are more than 10 then Sorting or order by doesn't work properly.

Suppose, In one2many field, I have more than 10 records, lets say 15 records and i have added order by on abc field then it performed sorting as below:-

1, 1.1, 1.10, 1.11, 1.12, 1.13, 1.14 ,1.15 ,1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9

but i expected the sorting as below:-

1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14 ,1.15

here is the code in which i have added order by:-

test_object = self.env['module.name'].search([], order='abc')

i have also tried implementing order by in one2many table as below:-

_order = "abc"

I have tried another solution by implementing order in tree view of one2many field:-

<tree default_order="abc">

but not working in any of the case.

How can i solve this issue? Do anyone have any idea related to this?

CZoellner
  • 13,553
  • 3
  • 25
  • 38
Gautam Bothra
  • 565
  • 1
  • 8
  • 23
  • That has nothing to do with Odoo directly, because the sorting is just the default one executed by PostgreSQL. Try to read about the topic ["collation"](https://www.postgresql.org/docs/10/collation.html) or try another way filling the column/field to get other results. – CZoellner Mar 15 '22 at 16:35

0 Answers0