You need to perform the following steps to get the sorted recordset of books based on release_date:
- Define a method called sort_books_by_date():
@api.model
def sort_books_by_date(self, books):
- Call sort() to get the email addresses of the contacts of the partner:
return books.sorted(key='release_date')