To extract records that have multiple authors from a recordset, you need to perform the following steps:
- Define the method to accept the original recordset:
@api.model def books_with_multiple_authors(self, all_books):
- Define an inner predicate function:
def predicate(book):
if len(book.author_ids) > 1:
return True
return False
- Call filter(), as follows:
return all_books.filter(predicate)