Mar
9
2016

Learn – How to create a Form View in Odoo 8

Greetings Everyone,

In this blog-post, you will learn how to create a Form View in an Odoo 8 module.

What is Form View in Odoo?

  • Form views are used to display the data from a single record.
  • Forms are used to create and edit single records.
  • The root element of a form view is <form>.
  • It consists  of regular HTML with additional structural and semantic components.
  • It is composed of high-level structure elements (groups, notebooks) and interactive elements (buttons and fields)

Example of a Form View :-

Earlier in my previous blog-post, I had created a Model to collect student’s information. Now I will create a Form View for the student model which will give it a User Interface from where entry can be created or edited.

Code for creating a Form View

 

Steps for creating Form View in Odoo

  • All views are stored in the database, in the ir.model.view model. To add a view in a module, we declare a <record> element describing the view in an XML file that will be loaded into the database when the module is installed.
  • The root element of a Form View is <form>
  • <sheet> tag is used to give the form a responsive layout
  • <group> is used to define column layouts in forms. By default, groups define 2 columns and most direct children of groups take a single column.
  • <field> direct children of groups display a label by default, and the label and the field itself have a colspan of 1 each.
  • <notebook> defines a tabbed section. Each tab is defined through a page child element.

SnapShot of Eclipse IDE:-

form view odoo module

Form View – Editable mode – Click on the image to enlarge

Form View - Editable mode - Click on the image to enlarge

Form View – Read-only Mode – Click on the image to enlarge

form view odoo module

form view odoo module

Hope you learnt how to create a Form View in Odoo module, your reviews/comments/suggestions/doubts are most welcomed, please comment in the section below, and subscribe to the newsletter to receive timely future updates of this blog.

Now next, Learn how to create a Tree View in Odoo 8.

Thank You

Share This!
Share On Twitter
Share On Linkdin
Contact us

Related Posts

About the Author: Burhan Vakharia

I, Burhan Vakharia, am a python developer, CS Lover living in Gandhinagar, Gujarat, India. I have a degree in Computer Science and Engineering from Babaria Institute of Technology. I am currently working as Odoo Developer at Serpent Consulting Services Pvt. Ltd., Gandhinagar. Apart form Odoo Framework, i have worked on C# .Net and Android Platforms.

Leave a comment

Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Contact us
Hide Buttons