April 2019
Beginner to intermediate
774 pages
24h 59m
English
Steps 1 and 2 carry out the extension of the business logic. We define a model that extends library.books and redefines the make_borrowed() and make_available() methods. In the last line of both methods, the result that was implemented by the parent class is returned:
return super(LibraryBook, self).make_borrowed()
In the case of Odoo models, the parent class is not what you'd expect by looking at the Python class definition. The framework has dynamically generated a class hierarchy for our recordset, and the parent class is the definition of the model from the modules that we depend on. So, the call to super() brings back the implementation of library.book from my_module. In this implementation, make_borrowed() changes the ...
Read now
Unlock full access