Adding fields to a model

We will extend the todo.task model to add some fields to it. As an example, we will now add the effort_estimate field, to be used for the amount of time expected to be spent on the task.

We will do this in a models/todo_task_model.py file, so we should also import it in the todo_stage/models/__init__.py file to have this content:

from . import todo_task_tag_modelfrom . import todo_task_stage_modelfrom . import todo_task_model

Now, create the todo_stage/models/todo_task_model.py file,  extending the original model:

from odoo import api, fields, models 
class TodoTask(models.Model): 
    _inherit = 'todo.task' 
    effort_estimate = fields.Integer() 

Here we declare a  class, based on models.Model, just like when we create new ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.