How to order a calculated date field

Hi,

I have the follow functional field

    date = fields.Function(fields.Date('Date'),
        'get_month_date')        
 
    def get_month_date(self, name=None):
        date_str = self.description

        if not date_str:
            return None
        try:
            date_obj = get_date_from_str(date_str)
            return date_obj
        except ValueError:
            return None

It works fine, now I need to order this field, The idea I have is to get the column of the string and after it pass it to date and then return to the result. Any suggest is welcome.

    @staticmethod
    def order_month_date(tables):

        pool = Pool()
        table, _ = tables[None]

        #date_str= table.date_str        
        #date = get_date_from_str(date_str)
        return [date]

In order to define an order, you need to be able to express the get_date_from_str in SQL.
The future SQLExpression field may help to avoid writing twice the code in Python and SQL.