O'Reilly logo

Odoo Development Essentials by Daniel Reis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating fields

After creating a new model, the next step is to add fields to it. Let's explore the several types of fields available in Odoo.

Basic field types

We now have a Stage model and will expand it to add some additional fields. We should edit the todo_ui/todo_model.py file, by removing some unnecessary attributes included before for the purpose of explanation, making it look like this:

class Stage(models.Model): _name = 'todo.task.stage' _order = 'sequence,name' # String fields: name = fields.Char('Name', 40) desc = fields.Text('Description') state = fields.Selection( [('draft','New'), ('open','Started'),('done','Closed')], 'State') docs = fields.Html('Documentation') # Numeric fields: sequence = fields.Integer('Sequence') perc_complete ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required