In step 2, we could have dispensed with the for wizard in self loop, and assumed that len(self) is 1, possibly adding a call to self.ensure_one() at the beginning of the method, like this:
@api.multi def record_borrows(self): self.ensure_one() member = self.member_id books = self.book_ids
loan = self.env['library.book.loan']
for book in books:
loan.create({'member_id': member.id, 'book_id': book.id})
We recommend using the version in the recipe, though, because it allows reusing the wizard from other parts of the code by creating records for the wizard, putting them in a single recordset (refer to the Combining recordsets recipe in Chapter 6, Basic Server Side Development, to see how to do this) and then calling record_loans() on the recordset. Granted that here the code is trivial and you don't really need to jump through all those hoops to record that some books were borrowed by different members. However, in an Odoo instance, some operations are much more complex, and it is always nice to have a wizard available that does "the right thing." When using such wizards, ensure that you check the source code for any possible use of the active_model/active_id/active_ids keys from the context, in which case, you need to pass a custom context (refer to the Call a method with a modified context recipe covered earlier for how to do this).