How to do it...

To extract records that have multiple authors from a recordset, you need to perform the following steps:

  1. Define the method to accept the original recordset:
    @api.model 
    def books_with_multiple_authors(self, all_books):
  1. Define an inner predicate function:
    def predicate(book):
if len(book.author_ids) > 1:
return True
return False
  1. Call filter(), as follows:
 return all_books.filter(predicate) 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset