Type of fields in odoo

Hello Odooers, Odoogig and Odoo Lovers,

In this Odoo Technical Tutorial, I would like to explain about what type of fields in odoo  in detail with syntax and example.

Basic fields in odoo

  • Char
  • Text
  • Integer
  • Float
  • Boolean
  • Binary
  • Date
  • Datetime
  • Selection

 

1.Char

  • When you want to store strings at that time this field is used

  • Its used when you want to limit the length of str

  • You have to specify limit of the string while defining the field

  • Syntax :

  • Example :

 

2.Text

  • It is same as Char Field but you can use strings in it without any limitation
  • such as if you wants to store large string at that time you can use this field
  • user feedback, notes, review these are examples of text field
  • Syntax :

  • Example :

 

3. Integer

  • If you wants to store only integer values, then you can use Integer Field
  • Integer is a whole number without fraction part such as 3 is integer but 3.5 is not integer
  • Syntax:

  • Example:

 

4.Float

  • If you want to store numbers with fraction part then you can use Float field
  • Float is a number with fraction part
  • such as 3.5 is float but 3 is not float
  • you can use Float Field where you wish to use Integer Field, but you cant do reverse. So Float Field is mostly used in odoo
  • Syntax:

  • Example:

 

5.Boolean

  • Boolean simply means, either value of field will be True of False
  • Boolean Field store only True and False
  • its just one type of Flag that determines status of any record
  • for example in employee’s screen if you want to check whether employee has contract or not, at that time you can use Boolean field
  • Syntax :

  • Example:

 

6.Binary

  • If you wants to upload something(file, image etc) and then want to store it in field at that time Binary Field is used
  • It store all kinds of files and images, like .doc, .excel, .png, .jpeg etc
  • when you define that field, it will give you an option to upload your file
  • you just have to click on upload button and one window will pop-up, then select your file and upload it
  • Syntax :

  • Example:

 

7.Date

  • If you want to store date, at that time Date Field is used
  • This field allows you to select date from one dialog box which looks like little calender
  • Date : 8-10-2018
  • Syntax :

  • Example:

 

8.Datetime

  • If you want to store date along with current time, at that time Datetime Field is used
  • This field allows you to select date and time from one dialog box which looks like little calender
  • Syntax :

  • Example:

 

9.Selection

  • Selection Field allows the user to make a selection from various predefined values
  • If you want multiple selection option then you can use selection field
  • while declaring selection field in .XML file at that time various widget will be used there
  • such as ‘selection’, ‘radio’, ‘statusbar’
  • we will see these 3 in different example
  • Syntax :

  • Example:

 

 

Cheers Odoo !

 


GET IN TOUCH.!

We’d Love to Hear from You! We are happy to answer any questions, you have regarding My Training.

Mail : getodootraining@gmail.com

Skype : mayur_maheshwari1

What’s app : +919924542042

LEAVE A REPLY

Leave a Reply

Your email address will not be published. Required fields are marked *