NameError: name 'api' is not defined
<p>Im trying to develop my first module on odoo 9.0 following the documentation and a developer manual for odoo, using the "TO-DO Tasks" example, but im having problems when I try to add a functionality to one of my buttons, in the manual says I have to add this code to my class file (todo_model.py).</p>

<pre><code>@api.one
def do_toggle_done(self):
    self.is_done = not self.is_done
    return True
</code></pre>

<p>But when I update the module on Odoo I got this message:</p>

<blockquote>
  <p>NameError: name 'api' is not defined</p>
</blockquote>

<p>This is my todo_model.py</p>

<pre><code># -*- encoding utf-8 -*-
from openerp import models,fields

class TodoTask(models.Model):
    _name   =   "todo.task"
    name    =   fields.Char('Description', required=True)
    is_done =   fields.Boolean('Done?')
    active  =   fields.Boolean('Active?', default=True)

    @api.one
    def do_toggle_done(self):
         self.is_done = not self.is_done
         return True
</code></pre>

<p>Best regards.</p>