How to do it...

To find the books, you need to perform the following steps:

  1. Add the find_book method in the library.book model:
def find_book(self): 
    ...
  1. Write the search domain for your criteria:
domain = [
'|',
'&', ('name', 'ilike', 'Book Name'),
('category_id.name', 'ilike', 'Category Name'),
'&', ('name', 'ilike', 'Book Name 2'),
('category_id.name', 'ilike', 'Category Name 2')
]
  1. Call the search() method with the domain, which will return the recordset:
books = self.search(domain) 
..................Content has been hidden....................

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