Now we will add some logic to our buttons. Edit the
todo_model.py Python file to add to the class the methods called by the buttons.
We will use the new API introduced in Odoo 8.0. For backward compatibility, by default Odoo expects the old API, and to create methods using the new API we need to use Python decorators on them. First we need to import the new API, so add it to the import statement at the top of the Python file:
from openerp import models, fields, api
The Toggle Done button's action will be very simple: just toggle the Is Done? flag. For logic on a record, the simplest approach is to use the
@api.one decorator. Here
self will represent one record. If the action was called for a set of records, the API would handle ...