'Order_by not working properly on a condition odoo 14

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?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source