Odoo Help

1

How to sort alphanumeric numeric values using python?

By
rosey
on 2/20/15, 7:07 AM 879 views

I have customer reference number like

FKM200,

ABD400,

DEF100,

ABD220,etc...

I want to sort the above reference number like :

DEF100,

FKM 200,

ABD220,

ABD400, ...

I have query = SELECT customer_id FROM res_partner order by CAST(SPLIT_PART(customer_id, '-', 2) AS INTEGER)"       

But my function is not working.

Please help me


 

can u post your total code

Odoo
on 2/21/15, 12:26 AM
1

Hi,

If your pattern is fix like first three character is alphabates and another three character is numbers then you can achieve your objective using below query.

select ref from res_partner order by substr(ref,4,3)

It will return result as you have describe into your question.

I hope it will help you.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 2/20/15, 7:07 AM
Seen: 879 times
Last updated: 3/16/15, 8:10 AM