-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Odoo Development Cookbook
By :

A field represents a column in a database table and defines the structure of the data that can be stored in that column. Fields in Odoo models are used to specify the attributes and characteristics of the data that the model will store. Each field has a data type (e.g., Char
, Integer
, Float
, or Date
) and various attributes that determine how the field behaves.
In this section, you will explore the various data types that fields can support and how to add them to a model.
This recipe assumes that you have an instance ready with the my_hostel
add-on module available, as described in Chapter 3, Creating Odoo Add-On Modules.
The my_hostel
add-on module should already have models/hostel.py
, defining a basic model. We will edit it to add new fields:
Hostel
model:from odoo import models, fields class Hostel(models.Model): # … ...