Hi all,
i have a module about the functionality of a library,inside that module i have a field named "author_ids" which is many2many from res.partner to store the id of author of a particular book,now i want to add a filter on those records which have more than one author_ids or in other words have more than one authors.so i added the function and just for learning purposes when i call it from a button i get this "attribute error" ,here is all my code:
cn someone kindly give me the solution:
author_ids = fields.Many2many ('res.partner', string = 'Authors')
@ api.model
def books_with_multiple_authors (self, all_books):
return all_books.filter (lambda b: len (b.author_ids)> 1)
<button name = "books_with_multiple_authors" string = "Practice" class = "oe_highlight" type = "object" />
all_books have no attribute filter is the error and when i remove all_books argument and try self,then it gives for ""library.book"