wrong sorting for "name" field in Odoo

Viewed 121

it may have a simple solution or none at all but its making me crazy ;) I hope there is somebody that knows something about it:

On my inventory "listing view" I have a column called "UID" (I translated from "Lot/Serial number" to "UID").

The thing is I try to sort it but as the field is a "text" it sorts wrong ( 1,10,100,.etc) Is there a way to sort it as number? to see it as : 1,2,3,4...etc

I am on the Odoo 15.0+e Enterprise Version with little access to the code.

1 Answers

With text field you can sort on the basis of UID field, but you need to suffix number of zeroes of max number of UID digits, like 0001. Following is the image sorted UIDs with desired results.

Lot/SN sorting

But, I'd suggest that you use custom sequence or integer field to assign UID via studio.

Related